SA-MP API client for python supporting both query and RCON APIs
Project description
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 2.7, 3.4, 3.5 and 3.6
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
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
samp-client-2.1.tar.gz
(6.8 kB
view hashes)
Built Distribution
samp_client-2.1-py3-none-any.whl
(17.1 kB
view hashes)
Close
Hashes for samp_client-2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfffe749cbb04037a5ab8f7af3cd7b47c3339c4c2d78c008d7945e379fc10b58 |
|
MD5 | d60b1a6098da698efa52d1f8fac0996b |
|
BLAKE2b-256 | 5ddc8eaa9ec9ce4c78736f728c6d6d81b3d719282820e048f83d5182814d61c8 |