def relnotes(filepath): ( guid, version, ) = xpifile.get_guid_and_version(filepath) stub = xpifile.get_amo_stub(guid) # path = 'https://addons.mozilla.org/api/v3/addons/addon/%s/versions/' % stub # response = http.request('GET', path) # for result in json.loads(response.data)['results']: # if result['version'] == version: # print result['edit_url'] # return print 'https://addons.mozilla.org/en-US/developers/addon/%s/versions' % stub with open(os.path.join(os.path.dirname(__file__), '.amorc'), 'r') as f: j = json.load(f) repo = j['repos'].get(guid, None) if repo is None: return new_tag = subprocess.check_output(['git', 'describe', '--tags']).splitlines()[0] old_tag = subprocess.check_output( ['git', 'describe', '--tags', '--always', 'HEAD^']).splitlines()[0] old_tag = old_tag.split('-')[0] print 'https://github.com/darktrojan/%s/compare/%s...%s' % (repo, old_tag, new_tag)
def upload(filepath): if not filepath.endswith('.xpi'): print 'Refusing to upload a non-xpi' exit(1) guid, version = xpifile.get_guid_and_version(filepath) method = 'PUT' path = 'https://addons.mozilla.org/api/v3/addons/%s/versions/%s/' % ( guid, version) headers = {'Authorization': 'JWT %s' % _token()} fields = { 'upload': (os.path.basename(filepath), open(filepath, 'rb').read()) } # print method # print path # print headers # return response = http.request_encode_body(method, path, headers=headers, fields=fields) print response.status # print response.getheaders() print response.data
def upload(filepath): if not filepath.endswith('.xpi'): print 'Refusing to upload a non-xpi' exit(1) guid, version = xpifile.get_guid_and_version(filepath) method = 'PUT' path = 'https://addons.mozilla.org/api/v3/addons/%s/versions/%s/' % (guid, version) headers = { 'Authorization': 'JWT %s' % token.token() } fields = { 'upload': (os.path.basename(filepath), open(filepath, 'rb').read()) } # print method # print path # print headers # return response = http.request_encode_body(method, path, headers=headers, fields=fields) print response.status # print response.getheaders() print response.data
def check_status(filepath): guid, version = xpifile.get_guid_and_version(filepath) method = 'GET' path = 'https://addons.mozilla.org/api/v3/addons/%s/versions/%s/' % ( guid, version) headers = {'Authorization': 'JWT %s' % _token()} return http.request(method, path, headers=headers)
def relnotes(filepath): (guid, version,) = xpifile.get_guid_and_version(filepath) stub = xpifile.get_amo_stub(guid) path = 'https://addons.mozilla.org/api/v3/addons/addon/%s/versions/' % stub response = http.request('GET', path) for result in json.loads(response.data)['results']: if result['version'] == version: print result['edit_url'] return
def check_status(filepath): guid, version = xpifile.get_guid_and_version(filepath) method = 'GET' path = 'https://addons.mozilla.org/api/v3/addons/%s/versions/%s/' % (guid, version) headers = { 'Authorization': 'JWT %s' % token.token() } return http.request(method, path, headers=headers)