An easy to use python API wrapper for the Random Stuff API.
- Easy-to-use & Organized
- Wraps the entire API
- Supports both async and sync
- Supports both v2 and v3 versions of API
- Supports all type of API plans
- Actively maintained
Installation can be done easily using the python package manager pip
pip install randomstuff.py
Firstly make sure to get the API key from here
Here are few examples to get you started.
import randomstuff
client = randomstuff.Client(key='api-key-here')
response = client.get_ai_response("Hi there")
client.close()
print(response)
import randomstuff
client = randomstuff.Client(key='api-key-here')
response = client.get_joke(type="any")
client.close()
print(response.joke)
import randomstuff
client = randomstuff.Client(key='api-key-here')
response = client.get_image(type="any")
client.close()
print(response)
This library also supports async usage.
import randomstuff
import asyncio
client = randomstuff.AsyncClient(key="api-key-here")
async def coro():
response = await client.get_ai_response("Hello world")
await client.close()
print(response)
loop = asyncio.get_event_loop()
loop.run_until_complete(coro())