@classmethod
def read(cls, err, **kw):
- self = cls(err.code, json.load(err), **kw)
+ self = cls(err.code, json.loads(err.read().decode("utf-8")), **kw)
return self
def jreq(url, data, auth):
enc = {"protected": authdata, "payload": data, "signature": seal}
try:
with req(url, data=enc) as resp:
- return json.load(resp), resp.headers
+ return json.loads(resp.read().decode("utf-8")), resp.headers
except urllib.error.HTTPError as exc:
if exc.headers["Content-Type"] == "application/problem+json":
raise problem.read(exc, url=url)
global _directory
if _directory is None:
with req(service) as resp:
- _directory = json.load(resp)
+ _directory = json.loads(resp.read().decode("utf-8"))
return _directory
def register(keysize=4096):