mirror of
https://github.com/OpenJarbas/PySychonaut.git
synced 2024-11-22 03:09:25 +01:00
added ege case incase ask the caterpillar is down
This commit is contained in:
parent
9ab72ad257
commit
deba6212ea
@ -470,6 +470,8 @@ class AskTheCaterpillar:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def ask_the_caterpillar(query):
|
def ask_the_caterpillar(query):
|
||||||
data = requests.post('https://www.askthecaterpillar.com/query', {"query": query})
|
data = requests.post('https://www.askthecaterpillar.com/query', {"query": query})
|
||||||
data = json.loads(data.text)
|
if data.status_code == 200:
|
||||||
return data["data"]["messages"][0]["content"]
|
data = json.loads(data.text)
|
||||||
|
return data["data"]["messages"][0]["content"]
|
||||||
|
else:
|
||||||
|
return f"Error {r.status_code}: {r.reason}"
|
||||||
|
Loading…
Reference in New Issue
Block a user