Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/extensions/utils.py

Issue 30017558: Noissue - Use latest stable AMO api (Closed) Base URL: https://hg.adblockplus.org/abpssembly/file/776cf4ca9d1d
Patch Set: Created Feb. 25, 2019, 9:03 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/utils.py
diff --git a/sitescripts/extensions/utils.py b/sitescripts/extensions/utils.py
index c70202b822044f85b74070a6c117b6f1db21c6b2..d6608e98cabc6fc96f9e829d55faf1f44e7860fd 100644
--- a/sitescripts/extensions/utils.py
+++ b/sitescripts/extensions/utils.py
@@ -277,16 +277,14 @@ def _getMozillaDownloadLink(galleryID):
"""
gets download link for a Gecko add-on from the Mozilla Addons site
"""
- url = 'https://services.addons.mozilla.org/en-US/firefox/api/1/addon/%s' % _urlencode(galleryID)
- document = _parseXMLDocument(url)
- linkTags = document.getElementsByTagName('install')
- linkTag = linkTags[0] if len(linkTags) > 0 else None
- versionTags = document.getElementsByTagName('version')
- versionTag = versionTags[0] if len(versionTags) > 0 else None
- if linkTag and versionTag and linkTag.firstChild and versionTag.firstChild:
- return (linkTag.firstChild.data, versionTag.firstChild.data)
- else:
- return (None, None)
+ url = 'https://addons.mozilla.org/api/v3/addons/addon/' + galleryID
+ with _urlopen(url) as data:
+ result = json.load(data)
+
+ return (
+ result['current_version']['files'][0]['url'],
+ result['current_version']['version']
+ )
def _getLocalLink(repo):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld