Skip to main content

A python library that emulates the osu! stable client

Project description

osu.py

Python 3.10+ License GitHub Actions Workflow Status

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 -e .

You can also build a source distribution and wheel locally:

pip install build
python -m build

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

For a more in-depth example, please view this project.

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

osu-1.5.1.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

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

osu-1.5.1-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

Details for the file osu-1.5.1.tar.gz.

File metadata

  • Download URL: osu-1.5.1.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for osu-1.5.1.tar.gz
Algorithm Hash digest
SHA256 0ca6ec72f8381e452ffc0ce64d77f2d1364ce56a54d9eedb7e7a0f2844b0bb91
MD5 140d14c9526a68043b74a02a56071623
BLAKE2b-256 e7510affec7b82d6aa8d3a2d01cf5aa7d3fd673cbb54b91bb2cb77a09453d22a

See more details on using hashes here.

File details

Details for the file osu-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: osu-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 46.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for osu-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1bd0b5deaedf6a3f2d7c8185b75290213b07a47f8bc797ec355dd16e5abeb690
MD5 13b8872cb54061bb9f6d27cc6a9b0182
BLAKE2b-256 b6c28120eedfa5fdc15ac707b2f41b8832fbbf0ec64e01d0a85bcf4f97280c6a

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