Metadata-Version: 2.1
Name: aiosu
Version: 1.0.0
Summary: Simple and fast osu! API v1 and v2 library
Home-page: https://github.com/NiceAesth/aiosu
License: GPLv3+
Keywords: osu!,osu,api
Author: Nice Aesthetics
Author-email: nice@aesth.dev
Requires-Python: >=3.9,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Typing :: Typed
Provides-Extra: docs
Provides-Extra: test
Requires-Dist: aiohttp (>=3.8.3,<4.0.0)
Requires-Dist: aiolimiter (>=1.0.0,<2.0.0)
Requires-Dist: emojiflags (>=0.1.1,<0.2.0)
Requires-Dist: orjson (>=3.8.3,<4.0.0)
Requires-Dist: pydantic (>=1.10.2,<2.0.0)
Requires-Dist: pytest (>=7.2.0,<8.0.0) ; extra == "test"
Requires-Dist: pytest-asyncio (>=0.20.2,<0.21.0) ; extra == "test"
Requires-Dist: pytest-mock (>=3.10.0,<4.0.0) ; extra == "test"
Requires-Dist: sphinx (>=5.3.0,<6.0.0) ; extra == "docs"
Requires-Dist: sphinx-rtd-theme (>=1.1.1,<2.0.0) ; extra == "docs"
Requires-Dist: toml (>=0.10.2,<0.11.0) ; extra == "test" or extra == "docs"
Requires-Dist: types-toml (>=0.10.8.1,<0.11.0.0) ; extra == "test"
Project-URL: Documentation, https://aiosu.readthedocs.io/
Project-URL: Repository, https://github.com/NiceAesth/aiosu
Description-Content-Type: text/x-rst

aiosu
=====

|Python| |pypi| |pre-commit.ci status| |rtd| |pytest| |mypy|

Simple and fast osu! API v1 and v2 library


Features
--------

- Support for API v1 and API v2
- Rate limit handling
- Utilities for osu! related calculations
- Easy to use


Installing
----------

**Python 3.9 or higher is required**

To install the library, simply run the following commands

.. code:: sh

    # Linux/macOS
    python3 -m pip install -U aiosu

    # Windows
    py -3 -m pip install -U aiosu

To install the development version, do the following:

.. code:: sh

    $ git clone https://github.com/NiceAesth/aiosu
    $ cd aiosu
    $ python3 -m pip install -U .


API v1 Example
--------------

.. code:: py

   import aiosu
   import asyncio


   async def main():
       # async with syntax
       async with aiosu.v1.Client("osu api token") as client:
           user = await client.get_user(7782553)

       # regular syntax
       client = aiosu.v1.Client("osu api token")
       user = await client.get_user(7782553)
       await client.close()


   if __name__ == "__main__":
       asyncio.run(main())


API v2 Example
--------------

.. code:: py

    import aiosu
    import asyncio
    import datetime


    async def main():
        token = aiosu.models.OAuthToken.parse_obj(json_token_from_api)

        # or

        token = aiosu.models.OAuthToken(
            access_token="access token",
            refresh_token="refresh token",
            expires_on=datetime.datetime.utcnow()
            + datetime.timedelta(days=1),  # can also be string
        )

        # async with syntax
        async with aiosu.v2.Client(
            client_secret="secret", client_id=1000, token=token
        ) as client:
            user = await client.get_me()

        # regular syntax
        client = aiosu.v2.Client(client_secret="secret", client_id=1000, token=token)
        user = await client.get_me()
        await client.close()


    if __name__ == "__main__":
        asyncio.run(main())


You can find more examples in the examples directory.


Contributing
------------

Please read the `CONTRIBUTING.rst <.github/CONTRIBUTING.rst>`__ to learn how to contribute to aiosu!


Acknowledgments
---------------

-  `discord.py <https://github.com/Rapptz/discord.py>`__
   for README formatting
-  `osu!Akatsuki <https://github.com/osuAkatsuki/performance-calculator>`__
   for performance and accuracy utils


.. |Python| image:: https://img.shields.io/pypi/pyversions/aiosu.svg
    :target: https://pypi.python.org/pypi/aiosu
    :alt: Python version info
.. |pypi| image:: https://img.shields.io/pypi/v/aiosu.svg
    :target: https://pypi.python.org/pypi/aiosu
    :alt: PyPI version info
.. |pre-commit.ci status| image:: https://results.pre-commit.ci/badge/github/NiceAesth/aiosu/master.svg
    :target: https://results.pre-commit.ci/latest/github/NiceAesth/aiosu/master
    :alt: pre-commit.ci status
.. |pytest| image:: https://github.com/NiceAesth/aiosu/actions/workflows/pytest.yml/badge.svg
    :target: https://github.com/NiceAesth/aiosu/actions/workflows/pytest.yml
    :alt: pytest Status
.. |mypy| image:: https://github.com/NiceAesth/aiosu/actions/workflows/mypy.yml/badge.svg
    :target: https://github.com/NiceAesth/aiosu/actions/workflows/mypy.yml
    :alt: mypy Status
.. |rtd| image:: https://readthedocs.org/projects/aiosu/badge/?version=latest
    :target: https://aiosu.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

