osuclient.py
osuclient.py aims to allow the emulation of the communication between an osu client and server through code.
It is now also available on PyPi
Note
Please make sure this is only used on servers which you have explicit permission to do so. Using this without permission may result in restrictions and bans as it is likely to break the rules there.
Uses
Having full control over what requests are being sent to a server can be extremely beneficial. It helps with:
- Debugging and testing rare scenarios
- Stress testing/benchmarking specific scenarios/usages
- Creating automated testing suites
Example
A basic client using osuclient.py would look something like this:
from osuclient.client import bancho
from osuclient.packets import constants
from osuclient.packets import rw
import asyncio
loop = asyncio.get_event_loop()
osu = bancho.OsuVersion(year= 2022, month= 6, day= 29)
hwid = bancho.HWIDInfo.generate_random()
client = bancho.BanchoClient.new(
version= osu,
hwid= hwid,
)
# Example custom packet handler.
@client.on_packet(constants.PacketID.SRV_NOTIFICATION)
async def on_notification(packet: rw.PacketContext) -> None:
print(f"Notification> {packet.reader.read_str()}")
async def main():
res = await client.connect(
username= "Username",
password= "Password",
server= bancho.TargetServer.from_base_url("server.example"),
)
if not res:
print("Failed to connect.")
return
print("Successfully connected.")
print(f"{client.username} ({client.user_id})")
print(f"Connected from {client.version.version} to {client.server.bancho}"
f" (v{client.protocol_version})")
await client.run_forever()
if __name__ == "__main__":
loop.run_until_complete(main())
Metadata
Release files for osuclient 0.2.1
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 |
|---|---|---|---|---|
| osuclient-0.2.1.tar.gz | 12.6 kB | Without provenance | Details for osuclient-0.2.1.tar.gz |
Release files / osuclient-0.2.1.tar.gz
| Download URL | osuclient-0.2.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a8d3100f3ff6e147518c9158878ff2c6522bf3799653beb3c833438ee87e44b
|
|
BLAKE2b-256 checksum How to use checksums |
9129a5845ba608a0ae09102dca99bdfd2527a594bb982f3fa943e6ea1e663c29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for osuclient 0.2.1
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.