ossapi (documentation) 
ossapi is the definitive python wrapper for the osu! api. ossapi has complete coverage of api v2 and api v1, and provides both sync (Ossapi) and async (OssapiAsync) versions for api v2.
If you need support or would like to contribute, feel free to ask in the #ossapi channel of the circleguard discord.
Installation
To install:
pip install ossapi
# or, if you want to use OssapiAsync:
pip install ossapi[async]
To upgrade:
pip install -U ossapi
To get started, read the docs: https://liam-devoe.github.io/ossapi/.
Quickstart
The docs have an in depth quickstart, but here's a super short version for api v2:
from ossapi import Ossapi
# create a new client at https://osu.ppy.sh/home/account/edit#oauth
api = Ossapi(client_id, client_secret)
# see docs for full list of endpoints
print(api.user("tybug").username)
print(api.user(12092800, mode="osu").username)
print(api.beatmap(221777).id)
Async
ossapi provides an async variant, OssapiAsync, which has an identical interface to Ossapi:
import asyncio
from ossapi import OssapiAsync
api = OssapiAsync(client_id, client_secret)
async def main():
await api.user("tybug")
asyncio.run(main())
Read more about OssapiAsync on the docs.
Other domains
You can use ossapi to interact with the api of other deployments of the osu website, such as https://dev.ppy.sh.
from ossapi import Ossapi
api = Ossapi(client_id, client_secret, domain="dev")
# get the dev server pp leaderboards
ranking = api.ranking("osu", "performance").ranking
# pearline06, as of 2023
print(ranking[0].user.username)
Read more about domains on the docs.
Endpoints
All endpoints for api v2.
- Beatmap Packs
- Beatmaps
- Beatmapsets
- Changelog
- Chat
- Comments
- Events
- Forums
- Friends
- Home
- Matches
- Me
- News
- OAuth
- Rankings
- Rooms
- Scores
- Seasonal Backgrounds
- Spotlights
- Users
- Wiki
API v1 Usage
You can get your api v1 key at https://osu.ppy.sh/home/account/edit#legacy-api.
Basic usage:
from ossapi import OssapiV1
api = OssapiV1("key")
print(api.get_beatmaps(user=53378)[0].submit_date)
print(api.get_match(69063884).games[0].game_id)
print(api.get_scores(221777)[0].username)
print(len(api.get_replay(beatmap_id=221777, user=6974470)))
print(api.get_user(12092800).playcount)
print(api.get_user_best(12092800)[0].pp)
print(api.get_user_recent(12092800)[0].beatmap_id)
Metadata
Release files for ossapi 5.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ossapi-5.3.6.tar.gz | 99.7 kB | Without provenance | Details for ossapi-5.3.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ossapi-5.3.6-py3-none-any.whl | Python 3 | none | any | Details for ossapi-5.3.6-py3-none-any.whl |
Total release size: 196.0 kB
Release files / ossapi-5.3.6.tar.gz
| Download URL | ossapi-5.3.6.tar.gz |
|---|---|
| Size | 99.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45b649b30eb7b8b251cd0ac49c32e0677304b5299dd639462765003c09ed3972
|
|
BLAKE2b-256 checksum How to use checksums |
f6766ffc98a742882d402deaa1fb2fed14fa6827435d570c47f8e34bf838dd13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / ossapi-5.3.6-py3-none-any.whl
| Download URL | ossapi-5.3.6-py3-none-any.whl |
|---|---|
| Size | 96.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69fbadacf0c857e87e3da54cfdf1d837ab3793eca8a4c12d407d2af020516369
|
|
BLAKE2b-256 checksum How to use checksums |
7e9cd36da0e359c1cc62a5416fb5db543ebd45e9da308aa914664e4c78dcfad8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for ossapi 5.3.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.