Skip to content

Commit

Permalink
Update qdox.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dchassin committed Oct 2, 2024
1 parent e92ff1f commit f707e08
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions qdox.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ def _get_json(*args,**kwargs):
with requests.get(*args,**kwargs,timeout=60) as res:
if res.status_code == 200:
return json.loads(res.text)
qargs = ",".join([repr(x) for x in args]) + \
",".join([f"{str(x)}={repr(y)}" for x,y in kwargs.items()])
qargs = [repr(x) for x in args] + \
[f"{str(x)}={repr(y)}" for x,y in kwargs.items()]
return {
"error": "request failed",
"message": f"requests.get({qargs}) -> StatusCode={res.status_code}",
"message": f"requests.get({','.join(qargs)}) -> StatusCode={res.status_code}",
}
except:
e_type, e_name, _ = sys.exc_info()
qargs = ",".join([repr(x) for x in args]) + \
",".join([f"{str(x)}={repr(y)}" for x,y in kwargs.items()])
qargs = [repr(x) for x in args] + \
[f"{str(x)}={repr(y)}" for x,y in kwargs.items()]
return {
"error": "request failed",
"message": f"requests.get({qargs}) -> {e_type.__name__}={e_name}",
"message": f"requests.get({','.join(qargs)}) -> {e_type.__name__}={e_name}",
}

class QdoxError(Exception):
Expand Down

0 comments on commit f707e08

Please sign in to comment.