Python Source Server Query Library
A Python package for communicating with a Source Engine Server over UDP
I push changes to the master branch whenever I finish a session of working on this. If you want the absolute latest version, download the code and use it manually, otherwise install through pip for the latest version I class as stable enough to use in your own projects.
Untested
- Split package payload decompression
- Split package size attribute detection
- CS:GO servers with
host_players_showset to 1 as I'm currently unable to find a server that uses this - Getting the players on a server running The Ship when someone is in the process of joining, as it relies on the count returned with the response packet, which may or may not differ from the actual number of players when someone is joining. (This descrepancy has not yet been observed on other servers despite the Valve dev wiki stating otherwise)
Installation
pip install sourceserver
Basic Usage
A SourceServer object acts as a connection to a Source engine server, with its own socket.
To instantiate a new SourceServer object, simply pass it a connection string in the form ipv4:port, the object will attempt to get the server's info, and if the connection fails after max retries, raises a SourceError.
Note, all errors that are expected are raised as SourceError, which marks the server as closed, but does not actually close the socket so the connection can be re-established.
The information regarding a server is retrieved each time you access the .info property, and is a dictionary in the form "info_type": "value".
A MasterServer object lets you query the Steam master servers, see the wiki for details
Example
>>> from sourceserver.sourceserver import SourceServer
>>> srv = SourceServer("89.35.29.5:27085")
Source Server @ 89.35.29.5:27085 | Connecting...
Source Server @ 89.35.29.5:27085 | Successfully established connection to server
>>> print(srv.info["game"])
Trouble in Terrorist Town
>>> print(srv.ping())
30.0
>>> print(srv.ping(2))
27.03
>>> count, players = srv.getPlayers()
>>> print(count)
6
>>> print(players[0])
(0, 'Nbx3k', 17, 9938.7001953125)
Discord Server
Discord Bot
https://github.com/Derpius/pythonsourceserverdiscordbot
License
GNU General Public License v3.0
Metadata
Release files for sourceserver 0.10.0
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 |
|---|---|---|---|---|
| sourceserver-0.10.0.tar.gz | 22.1 kB | Without provenance | Details for sourceserver-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sourceserver-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for sourceserver-0.10.0-py3-none-any.whl |
Total release size: 44.9 kB
Release files / sourceserver-0.10.0.tar.gz
| Download URL | sourceserver-0.10.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00f13edbe04ebb28c60592aea6c2c48a0c402c14a983c6076a0a3bf38523df2f
|
|
BLAKE2b-256 checksum How to use checksums |
ea7ae8fafc43e2fe232b83f286bb37d0816f18df41d5e4e1c392d7f8dc55c941
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.4
|
Release files / sourceserver-0.10.0-py3-none-any.whl
| Download URL | sourceserver-0.10.0-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76a05da43a66fd710041c5b58225a83b17833ef7f35dfd89cff2656962be2ee7
|
|
BLAKE2b-256 checksum How to use checksums |
910d6a0f946f21a56b559b143dd13d8ef79fa2ca2d2094e9d4a394946a60ff9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.4
|
Security for sourceserver 0.10.0
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.