Stands for Python random api wrapper version 2.
Project description
prsaw2
Simple python API wrapper for the Random Stuff API.
-
Easy to use
-
Wraps the entire API
-
Supports both async and sync
-
Supports v2, v3 and v4 version of API
Installation
Installation can be done easily using the python package manager pip
pip install prsaw2
Quickstart
Firstly make sure to get the API key from here
Here are few examples to get you started.
Getting AI response
import prsaw2
client = prsaw2.Client(key='api-key-here')
response = client.get_ai_response("Hi there")
client.close() # Not necessary
print(response)
Getting random joke
import prsaw2
client = prsaw2.Client(key='api-key-here')
response = client.get_joke(type="any")
client.close() # Not necessary
print(response.joke)
Getting random image
import prsaw2
client = prsaw2.Client(key='api-key-here')
response = client.get_image(type="any")
client.close()
print(response)
Async Support
The library also supports async usage.
import prsaw2
import asyncio
client = prsaw2.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())
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 Distribution
prsaw2-0.36.tar.gz
(5.3 kB
view details)
Built Distribution
prsaw2-0.36-py3-none-any.whl
(5.1 kB
view details)
File details
Details for the file prsaw2-0.36.tar.gz
.
File metadata
- Download URL: prsaw2-0.36.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5400c79cb0fa560e856358260e9255c97e1e3f9163aba8aa2407d7592f12ce48 |
|
MD5 | 0af39cd2d8bc664b366a1a8cac1d6296 |
|
BLAKE2b-256 | b6385901c2034fd5fb5253218b9fc4aab8d6a401f966ca298f94c655c3eb25c4 |
File details
Details for the file prsaw2-0.36-py3-none-any.whl
.
File metadata
- Download URL: prsaw2-0.36-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70eeedd1370f545e183d90506f69a80b00a0f41c3a548c036219cdac5cd3380e |
|
MD5 | c2a64c00f5bc244ba4c0b9127476640e |
|
BLAKE2b-256 | 6b0b82ee6a26bc74624de7bab95b56a498d02dac267e4d861b267ae2273aef60 |