예제 #1
0
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)
예제 #2
0
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
예제 #3
0
파일: amo.py 프로젝트: darktrojan/amoutils
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
예제 #4
0
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)
예제 #5
0
파일: amo.py 프로젝트: darktrojan/amoutils
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
예제 #6
0
파일: amo.py 프로젝트: darktrojan/amoutils
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)