mirror of
https://github.com/OpenJarbas/PySychonaut.git
synced 2024-11-21 18:59:24 +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
|
||||
def ask_the_caterpillar(query):
|
||||
data = requests.post('https://www.askthecaterpillar.com/query', {"query": query})
|
||||
if data.status_code == 200:
|
||||
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