1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 20:43:12 +00:00
Lumi/wrappers/inspirobot.py

21 lines
500 B
Python
Raw Normal View History

2024-09-22 15:35:13 +00:00
import httpx
class InspiroBot:
def __init__(self):
self.base_url = "https://inspirobot.me/api?generate=true"
async def get_image(self) -> str:
"""
Get a random motivational image from Inspirobot.
Returns
-------
str
The URL of the image.
"""
async with httpx.AsyncClient() as client:
response = await client.get(self.base_url)
response.raise_for_status()
return response.text