Metadata-Version: 2.4
Name: somerandomapi.py
Version: 0.1.3
Summary: An actively maintained wrapper for the somerandomapi API.
Author: Soheab_
License-Expression: MPL-2.0
Project-URL: homepage, https://github.com/Soheab/somerandomapi.py
Project-URL: documentation, https://somerandomapipy.readthedocs.io/
Project-URL: repository, https://github.com/Soheab/somerandomapi.py
Keywords: https://some-random-api.com,https://api.some-random-api.com,some-random-api,api,somerandomapi,random,images,fun,discord,discord.py,generation,rankcard,canvas,welcome,free,open-source,asyncio,aiohttp,async,wrapper
Classifier: Development Status :: 5 - Production/Stable
Classifier: Natural Language :: English
Classifier: Typing :: Typed
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: aiohttp<4.0.0,>=3.10.0
Provides-Extra: docs
Requires-Dist: Sphinx<9,>=8.2; extra == "docs"
Requires-Dist: furo<2025,>=2024.8; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints<4,>=3.2; extra == "docs"
Requires-Dist: enum-tools[sphinx]<0.14,>=0.13; extra == "docs"
Provides-Extra: dev
Requires-Dist: ruff==0.11.8; extra == "dev"
Dynamic: license-file

.. somerandomapi.py documentation master file, created by
   sphinx-quickstart on Sat Feb 25 22:53:53 2023.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to somerandomapi.py!
=============================
An actively maintained wrapper for the `somerandomapi API <https://somerandomapi.com>`_.

Installation
+++++++++++++
Install the stable version from `PyPI <https://pypi.org/project/somerandomapi.py/>`_ using pip:

.. code-block:: bash

    python -m pip install somerandomapi

Or the latest dev version from GitHub using pip and `git <https://git-scm.com/>`_:

.. code-block:: bash

   python -m pip install "somerandomapi.py @ git+https://github.com/Soheab/somerandomapi.py"

Basic Examples
+++++++++++++++

Get a random joke


.. code-block:: python3

   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:

.. code-block:: python

   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 <https://github.com/Soheab/somerandomapi.py/tree/main/examples>`_.

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_).

- `My Discord <https://discord.gg/yCzcfju>`_
- `Library Discord <https://discord.gg/tTUMWFd>`_

License
++++++++

This project is licensed under the MPL2-0 License. See the `LICENSE <https://github.com/Soheab/somerandomapi.py/blob/main/LICENSE>`_ file for details.


