An easy to use & feature-rich python API wrapper for Random Stuff API.
Project description
randomstuff.py
An easy to use, feature rich, highly customisable and async pythonic API wrapper for the Random Stuff API.
Features
- Easy-to-use & Organized
- Customisable
- Designed to be as optimized as possible
- Wraps the entire API including both versions, 3 and 4.
- Supports both async and sync
- Supports all type of API plans
- All classes are well documented
- Actively maintained, Remains up-to-date with all updates.
Installation
Installation can be done easily using the python package manager pip
pip install randomstuff.py
Quickstart
Firstly make sure to get the API key from here
Here are few examples to get you started.
Getting AI response
import randomstuff
with randomstuff.Client(api_key='api-key-here') as client:
response = client.get_ai_response("Hi there")
print(response.message)
Getting random joke
import randomstuff
with randomstuff.Client(api_key='api-key-here') as client:
joke = client.get_joke(type="any")
print(response.joke)
Getting random image
import randomstuff
with randomstuff.Client(api_key='api-key-here') as client:
image = client.get_image(type="any")
print(response)
Getting weather
import randomstuff
with randomstuff.Client(api_key='api-key-here') as client:
weather = client.get_weather("new york")
# print(weather) # Uncomment to see full object.
print("Current weather in {} is {} degree centigrade".format(weather.location.name, weather.current.temprature))
Async Support
This library also supports async usage.
import randomstuff
import asyncio
async def coro():
async with randomstuff.AsyncClient(api_key="api-key-here") as client:
response = await client.get_ai_response("Hello world")
print(response.message)
loop = asyncio.get_event_loop()
loop.run_until_complete(coro())
Contribution
This library is powered by community contributions. Feel free to open a pull requests and improve this library. Please consider following points:
- Briefly explain what you did.
- Use this template after your PR description and mark certain checkboxes with
x
as per your PR.
- [ ] This is a code change (Improvement, bug fix, new feature)
- [ ] Bug fix
- [ ] Improvement
- [ ] Feature added
- [ ] The change is not a code change (ReadMe change, examples add, examples update etc.)
- [ ] README change
- [ ] Example Change
- [ ] Added Example
- [ ] Removed Example
- [ ] Updated Example
- [ ] The change are tested
- [ ] Change is breaking change
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for randomstuff.py-1.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb46a632b0dc7b314889d29305bbc980abfaab39b9c127fcb8d641e4d892012 |
|
MD5 | b8d57a1e4ea7e2bfc28884b1717a9147 |
|
BLAKE2b-256 | ca486f9444c442f30c6c1e0ae3b1da526f9fabcb4bbd02bf032d119114747bf4 |