mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 20:43:12 +00:00
21 lines
500 B
Python
21 lines
500 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() as client:
|
||
|
response = await client.get(self.base_url)
|
||
|
response.raise_for_status()
|
||
|
return response.text
|