Index: globals/get_browser_versions.py |
=================================================================== |
--- a/globals/get_browser_versions.py |
+++ b/globals/get_browser_versions.py |
@@ -128,8 +128,11 @@ |
BROWSERS['opera'] = get_opera_versions |
-def get_yandex_version(suffix): |
- response = urllib.urlopen('https://api.browser.yandex.ru/update-info/browser/yandex%s/win-yandex.xml' % suffix) |
+def key_by_version(version): |
+ return map(int, version.split('.')) |
+ |
+def get_yandex_version_raw(suffix, params): |
+ response = urllib.urlopen('https://api.browser.yandex.ru/update-info/browser/yandex%s/win-yandex.xml' % (suffix, params)) |
Wladimir Palant
2015/06/03 17:11:36
If I'm not mistaken this should produce "not all a
Sebastian Noack
2015/06/03 17:42:31
Argh, you are right. I did test the change, but in
|
try: |
doc = minidom.parse(response) |
finally: |
@@ -139,9 +142,18 @@ |
description = item.getElementsByTagName('description')[0] |
return re.search(r'\d+\.\d+', description.firstChild.nodeValue).group(0) |
+def get_yandex_version(suffix=''): |
+ return max( |
+ [ |
+ get_yandex_version_raw(suffix, ''), |
+ get_yandex_version_raw(suffix, '?manual=yes'), |
+ ], |
+ key=key_by_version |
+ ) |
+ |
def get_yandex_versions(): |
return { |
- 'current': get_yandex_version(''), |
+ 'current': get_yandex_version(), |
'unreleased': [get_yandex_version('-beta')] |
} |
@@ -209,7 +221,7 @@ |
# to list each version only once. |
versions['unreleased'] = sorted( |
set(versions['unreleased']) - {current, previous}, |
- key=lambda ver: map(int, ver.split('.')) |
+ key=key_by_version |
) |
versions['timestamp'] = now |