mirror of
https://github.com/OpenJarbas/PySychonaut.git
synced 2024-11-25 12:49:26 +01:00
Merge pull request #1 from AcidicNic/askthecaterpillar_edgecase
added edge case incase ask the caterpillar is down
This commit is contained in:
commit
52222d565c
@ -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