Fix update checker, migrate to requests package for all network stuff. The eveapi package is probably not going to work with caching and whatnot, but pyfa doesn't use it and XML API is EOL anyway

This commit is contained in:
blitzmann
2018-03-04 18:08:34 -05:00
parent 7956ca0409
commit 4fac10ccb7
5 changed files with 58 additions and 60 deletions

View File

@@ -49,13 +49,13 @@ class CheckUpdateThread(threading.Thread):
try:
response = network.request('https://api.github.com/repos/pyfa-org/Pyfa/releases', network.UPDATE)
jsonResponse = json.loads(response.read())
jsonResponse = response.json()
jsonResponse.sort(
key=lambda x: calendar.timegm(dateutil.parser.parse(x['published_at']).utctimetuple()),
reverse=True
)
for release in jsonResponse:
for release in jsonResponse[:5]:
rVersion = Version(release['tag_name'])
cVersion = Version(config.version)
@@ -73,8 +73,8 @@ class CheckUpdateThread(threading.Thread):
if rVersion > cVersion:
wx.CallAfter(self.callback, release, rVersion)
break
break
except Exception as e:
pyfalog.error("Caught exception in run")
pyfalog.error(e)