1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 20:23:12 +00:00
Lumi/wrappers/inspirobot.py
2024-09-22 17:45:48 +02:00

20 lines
512 B
Python

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(timeout=10.0) as client:
response = await client.get(self.base_url)
response.raise_for_status()
return response.text