An actively maintained wrapper for the somerandomapi API.
Installation
Install the stable version from PyPI using pip:
python -m pip install somerandomapi
Or the latest dev version from GitHub using pip and git:
python -m pip install "somerandomapi.py @ git+https://github.com/Soheab/somerandomapi.py"
Basic Examples
Get a random joke
import asyncio
import somerandomapi
sra_api = somerandomapi.Client("<optional api token>")
async def main():
joke = await sra_api.joke()
print(joke)
await sra_api.close()
asyncio.run(main())
Use the chatbot feature:
import asyncio
import somerandomapi
async def main():
async with somerandomapi.Client("<optional api token>") as sra_api:
stopped: bool = False
while not stopped:
# can also do await sra-api.chatbot("message") to get a response immediately
# but this is more efficient for long conversations
async with sra_api.chatbot() as chatbot:
user_input = input("You: ")
if user_input.lower() == "stop":
stopped = True
print("Stopping the chatbot.")
break
# can also do await chatbot.send("message") to get a response
async with chatbot.send(user_input) as response:
if response is None:
print("No response received.")
continue
print(f"Bot: {response.response}")
asyncio.run(main())
See more examples in the examples directory on GitHub.
Documentation
Visit the full documentation at: https://somerandomapipy.readthedocs.io
Contact
For any questions, suggestions, or issues, feel free to reach out to me on Discord (@Soheab_).
License
This project is licensed under the MPL2-0 License. See the LICENSE file for details.
Metadata
Release files for somerandomapi.py 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| somerandomapi_py-0.1.3.tar.gz | 48.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| somerandomapi_py-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.7 kB
Release files / somerandomapi_py-0.1.3.tar.gz
| Download URL | somerandomapi_py-0.1.3.tar.gz |
|---|---|
| Size | 48.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
316a6e0cd5e6c665ef5c8e8603b782fcc27f308865fa0b8b9b7368c3dc1ce7b2
|
|
BLAKE2b-256 checksum How to use checksums |
9f8d91befa3969955384fb6c9cf10621f073a30cb79e9f2e01dc20c20b0efc67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2025.
Transparency logRelease files / somerandomapi_py-0.1.3-py3-none-any.whl
| Download URL | somerandomapi_py-0.1.3-py3-none-any.whl |
|---|---|
| Size | 59.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1448a727c67c0c791939ec41a82d044269f63f2f838470d6274453aa550fa785
|
|
BLAKE2b-256 checksum How to use checksums |
df273cdee86ec12e2791007e8fad883b77d7bb5e5b868b4f6a36b83595803065
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2025.
Transparency log