GTA SA-MP client
RCON and query client library for Python
A modern Python library for querying and managing SA-MP servers.
Supported Python version 3.4 or newer. If you require support for Python 2.7, install 2.1 version of the package.
Installation
pip install samp-client
Usage
The library can be easily interfaced using a single SampClient class:
from samp_client.client import SampClient
with SampClient(address='localhost', port=7777) as client:
print(client.get_server_info())
The library also allows you to run RCON commands as well as queries:
from samp_client.client import SampClient
with SampClient(address='localhost', port=7777, rcon_password='password') as client:
client.rcon_cmdlist()
Query and RCON responses are parsed into native Python structures:
from samp_client.client import SampClient
with SampClient(address='localhost', port=7777, rcon_password='password') as client:
info = client.get_server_info()
print(info)
# ServerInfo(password=True, players=9, max_players=100, hostname='Convoy Trucking', gamemode='Convoy Trucking 3.1.1', language='English')
print(info.gamemode)
# 'Convoy Trucking 3.1.1'
print(client.rcon_get_hostname())
# ServerVar(name='hostname', value='Convoy Trucking', read_only=False)
print(client.rcon_players()[0].ping)
# 26
Examples
Folder example/ contains usage example of the library
Running tests
To run tests:
python -m unittest discover -v
Release files for samp-client 3.0.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 | |
|---|---|---|---|
| samp-client-3.0.1.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| samp_client-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / samp-client-3.0.1.tar.gz
| Download URL | samp-client-3.0.1.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41e65cedd0b511bd6c19e385daa44f179fc988fb8848df1b969588bd70dbb94e
|
|
BLAKE2b-256 checksum How to use checksums |
c479e1c20961a12e64799c0bda4f0c597693e16025ac2a4df0f5684cfc26c7b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.9
|
Release files / samp_client-3.0.1-py3-none-any.whl
| Download URL | samp_client-3.0.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
344c4dadd59104f7fa761ca130cf049fb865b8a889a8b900dbd789b8e89f96ca
|
|
BLAKE2b-256 checksum How to use checksums |
ef4b8db1d6e0fc221e57795d415eb77a0424a3cd20af217fdaafb0040b92b388
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.9
|