Skip to main content

Simple and fast osu! API v1 and v2 library

Project description

Python version info PyPI version info pre-commit.ci status Documentation Status pytest Status mypy Status Codacy Status

Simple and fast asynchronous osu! API v1 and v2 library with various utilities.

Features

  • Support for modern async syntax (async with)

  • Support for API v1 and API v2

  • Rate limit handling

  • Utilities for osu! related calculations

  • Easy to use

Installing

Python 3.10 or higher is required

To install the library, simply run the following commands

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

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

To install the development version, do the following:

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

API v1 Example

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.aclose()


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

API v2 Example

import aiosu
import asyncio
import datetime


async def main():
    token = aiosu.models.OAuthToken.model_validate(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.aclose()


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

You can find more examples in the examples directory.

Contributing

Please read the CONTRIBUTING.rst to learn how to contribute to aiosu!

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiosu-2.3.6.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiosu-2.3.6-py3-none-any.whl (80.0 kB view details)

Uploaded Python 3

File details

Details for the file aiosu-2.3.6.tar.gz.

File metadata

  • Download URL: aiosu-2.3.6.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.10.20 Linux/6.14.0-1017-azure

File hashes

Hashes for aiosu-2.3.6.tar.gz
Algorithm Hash digest
SHA256 6022aedb4789fd50110852c7066ae6d9451f795b02ef0ef0c0b644fbb15b929b
MD5 63d18d2b9ae220c4d31b4f4275c23550
BLAKE2b-256 50c79cfc9974fd62345924e8960e57a8319679b7259acf7ebff8d8435e402c55

See more details on using hashes here.

File details

Details for the file aiosu-2.3.6-py3-none-any.whl.

File metadata

  • Download URL: aiosu-2.3.6-py3-none-any.whl
  • Upload date:
  • Size: 80.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.10.20 Linux/6.14.0-1017-azure

File hashes

Hashes for aiosu-2.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c3dea06b76a9f91983ec6c26bccc6327596c6f207ca0aa1de0479abfc265fa
MD5 12b77abe7b20c6a5b3e5962105039e27
BLAKE2b-256 93fa1bc0cc5f9a0d5fdaa91395a1fe4a51e04e8a8177b31324c552b312a5aa82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page