Fix urllib request decoding

This commit is contained in:
Doctor 2021-12-10 21:02:23 +01:00 committed by Lars Kruse
parent 16d38264aa
commit 87280ed7c3
1 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ Copyright (C) 2019 pcy <pcy.ulyssis.org>
import os
import json
import urllib
import urllib.request
import sys
@ -57,7 +57,7 @@ logarithmic = weakbool(os.getenv('logarithmic', 'N'))
def reqjson():
try:
raw_data = urllib.request.urlopen(url)
return json.loads(raw_data)
return json.loads(raw_data.read().decode())
except IOError:
print("Cannot reach the GitLab API endpoint.", file=sys.stderr)
exit(1)