2020-01-08 01:26:36 +00:00
|
|
|
'''
|
|
|
|
A module that sits between the API and the cog
|
|
|
|
and provides functions for easy communication
|
|
|
|
with the inspirobot API
|
|
|
|
'''
|
2020-01-07 03:07:39 +00: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 17:04:00 +00:00
|
|
|
logging.error(f"Inspirobot API response not OK: {response.status_code} [http://inspirobot.me/api?generate=true]")
|
2020-01-07 03:07:39 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
return response.text
|