A python library that emulates the osu! stable client
Project description
osu.py
osu.py is a python library that emulates part of the online functionality of the osu! stable client.
IMPORTANT:
Use this library at your own risk! I am not responsible for any unexpected behavior of the client or anything that can happen to your account. If you want to test it out on a custom server, you can set the server
attribute when initializing the client.
You can install this package with pip:
pip install osu
Or build it manually:
git clone https://github.com/Lekuruu/osu.py.git
cd osu.py
pip install setuptools
python setup.py install
Features
- Receiving player stats
- Sending/Receiving chat messages
- Spectating
- Avatars
- Comments
- Replays
- Scores/Leaderboards
- Tournament client behaviour
- Direct Search
- Direct Download
- Multiplayer
- Documentation
Example
Here is a small example of how to use this package:
from osu.bancho.constants import ServerPackets
from osu.objects import Player
from osu import Game
import logging
# Enable extended logging
logging.basicConfig(
level=logging.INFO,
format='[%(asctime)s] - <%(name)s> %(levelname)s: %(message)s'
)
# Initialize the game class
game = Game(
USERNAME,
PASSWORD
)
# Simple message handler
@game.events.register(ServerPackets.SEND_MESSAGE)
def on_message(sender: Player, message: str, target: Player):
if message.startswith('?ping'):
sender.send_message('pong!')
# Run the game
game.run()
You can also run tasks, independent of server actions:
# Example of a task, running every minute
@game.tasks.register(minutes=1, loop=True)
def example_task():
...
You can also run this project with asyncio:
pip install asyncio
import asyncio
game = Game(
USERNAME,
PASSWORD
)
# Run the game
asyncio.run(game.run_async())
For a more in-depth example, please view this project.
If you have any questions, feel free to contact me on discord: lekuru
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 osu-1.4.10.tar.gz
.
File metadata
- Download URL: osu-1.4.10.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5192c5a3bfb305e3477896920ddbfe86ead51b24b07b015bcb4851836f5e0f45 |
|
MD5 | bc78b39146a7b33c543219cb97d67a53 |
|
BLAKE2b-256 | 59a979f4068437b3a0fef676244c9cba749aca23cb0de8a50e141566c5948024 |
File details
Details for the file osu-1.4.10-py3-none-any.whl
.
File metadata
- Download URL: osu-1.4.10-py3-none-any.whl
- Upload date:
- Size: 39.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9677fd0ad40a06c0c56036b60ba1aaa303dd31ba654dac4605d512cc1e80a1f |
|
MD5 | 5fbb9b77b9d9828ac062eba4c39db09d |
|
BLAKE2b-256 | cd697c75fa6bf5271835e52ffbd3f02bdd3969558b092cc970ec00374d9293ec |