2020-01-08 02:26:36 +01:00
|
|
|
'''
|
|
|
|
A module that sits between the API and the cog
|
|
|
|
and provides functions for easy communication
|
|
|
|
with the inspirobot API
|
|
|
|
'''
|
2020-01-07 04:07:39 +01:00
|
|
|
import requests
|
|
|
|
from util import logging
|
|
|
|
|
|
|
|
def get_inspirational_quote() -> str:
|
|
|
|
response = requests.get("http://inspirobot.me/api?generate=true")
|
|
|
|
|
|
|
|
if not response.ok:
|
2020-01-07 18:04:00 +01:00
|
|
|
logging.error(f"Inspirobot API response not OK: {response.status_code} [http://inspirobot.me/api?generate=true]")
|
2020-01-07 04:07:39 +01:00
|
|
|
return None
|
|
|
|
|
|
|
|
return response.text
|