mirror of
https://github.com/OpenJarbas/PySychonaut.git
synced 2024-11-25 20:59:25 +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
|
@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