1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

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

View file

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