Skip to main content

samp-query

CI

samp-query logo

samp-query is a Python library for interacting with SA-MP/open.mp servers using the query protocol. It provides functionality to query server information, retrieve player list, show rules, and execute remote console (RCON) commands.

Installation

To install the library, you can use pip:

pip install samp-query

Features

  • Connect to a game server using IP address and port.
  • Retrieve server information including name, player count, maximum players, gamemode, and language.
  • Get a list of players currently on the server with their name and score.
  • Fetch a list of rules and their values set on the server.
  • Execute RCON commands on the server (requires RCON password).

Usage

Here's a basic example of how to use the library:

import trio
from samp_query import Client


async def main():
    client = Client(
        ip='127.0.0.1',
        port=7777,
        rcon_password=None,  # Your rcon password as string
    )

    info = await client.info()
    print(f'Server Name: {info.name}')
    print(f'Player Count: {info.players}/{info.max_players}')

    player_list = await client.players()
    print('Players:')

    for player in player_list.players:
        print(f'- {player.name} (Score: {player.score})')

    rule_list = await client.rules()
    print('Rules:')

    for rule in rule_list.rules:
        print(f'- {rule.name}: {rule.value}')

    if client.rcon_password:
        response = await client.rcon('echo Hello, server!')
        print(f'RCON Response: {response}')


trio.run(main)

Make sure to replace '127.0.0.1' and 7777 with the actual IP address and port of the game server you want to connect to. If the server has RCON enabled, provide a password in the rcon_password attribute of the samp_query.Client instance (otherwise keep it None).

Documentation

For more information, you can read the documentation.

Metadata

Release files for samp-query 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for samp-query 0.6.0
File Size Uploaded Provenance Actions
samp_query-0.6.0.tar.gz 6.8 kB Without provenance Details for samp_query-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for samp-query 0.6.0
File Interpreter ABI Platform Actions
samp_query-0.6.0-py3-none-any.whl Python 3 none any Details for samp_query-0.6.0-py3-none-any.whl

Total release size: 14.8 kB

Release files / samp_query-0.6.0.tar.gz

Download URL samp_query-0.6.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c2f19d03087e046f8d9b2b555d4c94e9084ebe9a36490eccfc54bbba54356e59
BLAKE2b-256 checksum
How to use checksums
b95dd8f8bc0742f2cfe38cdcf839ee686a36a6708d09a9c9fed8a0acdf3b29c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / samp_query-0.6.0-py3-none-any.whl

Download URL samp_query-0.6.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4be1304a4eeaf2e8186f9aa458f4fd3d7bdc4e7bc87557a8cd420635416d96f
BLAKE2b-256 checksum
How to use checksums
38522af65d984e8fc5f8f69b34839a25b68242672fb106dc8c77ed3e1ac720bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for samp-query 0.6.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page