AsyncClient
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Same as Client
but this is completely async class. This class is suitable for async programs like discord bots etc.
Just to assure, This is a simple example for you using this class.
import randomstuff
import asyncio
client = randomstuff.AsyncClient(api_key="api-key")
async def coro():
ai = await client.get_ai_response("hi")
image = await client.get_image("any")
joke = await client.get_joke("any")
weather = await client.get_weather("new york")
await client.close()
print("AI: ", ai.message)
print("Joke: ", joke.joke)
print("Image: ", image)
print("Temprature in NY: ", weather.current.temperature)
loop = asyncio.get_event_loop()
loop.run_until_complete(coro())