[F] Handle errors on sendRequest
This commit is contained in:
+9
-6
@@ -99,9 +99,12 @@ def wrap(string: str):
|
|||||||
|
|
||||||
|
|
||||||
def sendRequest(req):
|
def sendRequest(req):
|
||||||
response = create(req)
|
try:
|
||||||
text = response.text
|
response = create(req)
|
||||||
if response.headers['Content-Type'] == 'application/json':
|
text = response.text
|
||||||
text = dictToString(json.loads(text))
|
if response.headers['Content-Type'] == 'application/json':
|
||||||
response.close()
|
text = dictToString(json.loads(text))
|
||||||
return text
|
response.close()
|
||||||
|
return text
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
return "Error: ConnectionError!\n" + str(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user