diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-12-29 17:36:17 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-12-29 17:36:17 (GMT) |
commit | ecd6b51b126ee473c4942a53d1b17a76dd6b11c3 (patch) | |
tree | f0a434c4f6a8a4423b05ba2cac6cb724157e9b3f /plugins | |
parent | 5cad06b6a52e17d5649e0152c15745a96f7c0efa (diff) |
Avoided to crash when the Internet is not reachable.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/python/welcome/version.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/python/welcome/version.py b/plugins/python/welcome/version.py index c823d60..9bd4db2 100644 --- a/plugins/python/welcome/version.py +++ b/plugins/python/welcome/version.py @@ -76,19 +76,24 @@ To display the lastest available version, please install the <b>urllib3</b> pack lastest = None http = urllib3.PoolManager() - request = http.request('GET', 'http://0xdeadc0de.fr/chrysalide/updates/versions') + try: + request = http.request('GET', 'http://0xdeadc0de.fr/chrysalide/updates/versions') + except urllib3.exceptions.MaxRetryError: + request = None - html = request.data.decode('utf-8') + if request != None: - request.release_conn() + html = request.data.decode('utf-8') - available = html.split('\n') + request.release_conn() - for a in available: - desc = a.split('=') - if desc[0] == category: - lastest = desc[1] - break + available = html.split('\n') + + for a in available: + desc = a.split('=') + if desc[0] == category: + lastest = desc[1] + break return lastest |