A python wrapper for the osu! api. Includes api v2 support.
Project description
ossapi (documentation)
ossapi is a python wrapper for the osu! api. ossapi supports both api v2 and api v1 and has every endpoint in both versions implemented.
To install:
pip install ossapi
To upgrade:
pip install -U ossapi
To get started, read the docs: https://circleguard.github.io/ossapi/.
If you need support or would like to contribute, feel free to join the circleguard discord: https://discord.gg/e84qxkQ.
Quickstart
The docs have an in depth quickstart, but here's a super short version:
from ossapi import Ossapi
# create a new client at https://osu.ppy.sh/home/account/edit#oauth
client_id = None
client_secret = None
callback_url = None # choose a port on localhost, eg http://localhost:727/
# client credentials authentication...
api = Ossapi(client_id, client_secret)
# ...or authorization grant authentication
api = Ossapi(client_id, client_secret, callback_url)
# go wild with endpoint calls! See docs for all endpoints
print(api.user("tybug2"))
API v1 Usage
You can get your api v1 key at https://osu.ppy.sh/p/api/. Note that due to a redirection bug, you may need to log in and wait 30 seconds before being able to access the api page through the above link.
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ossapi-3.0.0.tar.gz
.
File metadata
- Download URL: ossapi-3.0.0.tar.gz
- Upload date:
- Size: 64.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e713bc878fb52c9f1846bf4bd7e205f25bb993ec8c91b18ef303e13bde47a03d |
|
MD5 | 0afea2c03785b2bbe7b2cf68ab0b26c1 |
|
BLAKE2b-256 | 472b3dfc5f8c33ae07374ab2816e8a4652beaa1851ddca2f36d48d9a47f644d2 |
File details
Details for the file ossapi-3.0.0-py3-none-any.whl
.
File metadata
- Download URL: ossapi-3.0.0-py3-none-any.whl
- Upload date:
- Size: 67.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f3133328c0af23bdcb63f8a980aa042228c6df5804c2f670fda250f2d9de1b5 |
|
MD5 | 89fdb88626940bdb185d6bede5c578bc |
|
BLAKE2b-256 | 05b5a7a41af1e5835eea462ef8de3f6a3711b4f6e466888fafc3e7a8717b2c66 |