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

Unified Diff: globals/get_browser_versions.py

Issue 29515558: Issue 5496 - Use omahaproxy to get chrome-versions (Closed)
Patch Set: Created Aug. 14, 2017, 8:01 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: globals/get_browser_versions.py
diff --git a/globals/get_browser_versions.py b/globals/get_browser_versions.py
index 1f8f0e1b454efb9c3eea31ccc6b54753d2f24761..b6ad67d446771121427783fb145de2ab08b783fa 100644
--- a/globals/get_browser_versions.py
+++ b/globals/get_browser_versions.py
@@ -15,21 +15,7 @@ BASE_URL = 'https://product-details.mozilla.org/1.0'
FIREFOX_URL = BASE_URL + '/firefox_versions.json'
THUNDERBIRD_URL = BASE_URL + '/thunderbird_versions.json'
SEAMONKEY_URL = 'http://www.seamonkey-project.org/seamonkey_versions.json'
-
-CHROME_UPDATE_XML = '''\
-<?xml version="1.0" encoding="UTF-8"?>
-<request protocol="3.0" ismachine="0">
- <os platform="win" version="99" arch="x64"/>
- <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}">
- <updatecheck/>
- </app>
- <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-beta-multi-chrome">
- <updatecheck/>
- </app>
- <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome">
- <updatecheck/>
- </app>
-</request>'''
+CHROME_URL = 'https://omahaproxy.appspot.com/all.json?os=win'
cache = {}
@@ -93,21 +79,25 @@ def get_seamonkey_versions():
BROWSERS['seamonkey'] = get_seamonkey_versions
-def get_chrome_version(manifest):
- return manifest.getAttribute('version').split('.')[0]
+def get_chrome_version(version_info):
+ return version_info['version'].split('.')[0]
def get_chrome_versions():
- response = urllib.urlopen('https://tools.google.com/service/update2', CHROME_UPDATE_XML)
+ response = urllib.urlopen(CHROME_URL)
try:
- doc = minidom.parse(response)
+ data = json.load(response)
finally:
response.close()
- manifests = doc.getElementsByTagName('manifest')
+ channels = {x['channel']: x for x in data[0]['versions']}
Sebastian Noack 2017/08/14 11:54:31 It seems the logic can be simplified. All data we
tlucas 2017/08/14 12:08:28 Done.
+
return {
- 'current': get_chrome_version(manifests[0]),
- 'unreleased': map(get_chrome_version, manifests[1:])
+ 'current': get_chrome_version(channels['stable']),
+ 'unreleased': map(
+ get_chrome_version,
+ (channels['beta'], channels['dev'])
+ ),
}
BROWSERS['chrome'] = get_chrome_versions
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld