FirmwareUpdateChecker: Small fixes (typing and lowercase input).

This commit is contained in:
Remco Burema 2018-10-12 10:11:46 +02:00
parent f2b50c748c
commit 69cef98c30
2 changed files with 3 additions and 4 deletions

View file

@ -39,9 +39,8 @@ class FirmwareUpdateCheckerJob(Job):
try:
request = urllib.request.Request(url, headers=self._headers)
current_version_file = urllib.request.urlopen(request)
reader = codecs.getreader("utf-8")
result = reader(current_version_file).read(firstline=True)
response = urllib.request.urlopen(request)
result = response.read().decode('utf-8')
except URLError:
Logger.log('w', "Could not reach '{0}', if this URL is old, consider removal.".format(url))

View file

@ -42,7 +42,7 @@ class FirmwareUpdateCheckerLookup:
try:
for machine_json in machines_json:
machine_id = machine_json.get("id")
machine_name = machine_json.get("name")
machine_name = machine_json.get("name").lower() # Lower in case upper-case char are added to the json.
self._machine_ids.append(machine_id)
self._machine_per_name[machine_name] = machine_id
version_parse_function = \