Skip to main content

🐍 OpenGSQ - Python library for querying game servers

Project description

OpenGSQ Python Library

Python Package GitHub license PyPI version Python versions Downloads

The OpenGSQ Python library provides a convenient way to query servers from applications written in the Python language.

Supported Protocols

The library supports a wide range of protocols. Here are some examples:

from opengsq.protocols import (
    AoE1,
    AoE2,
    ASE,
    AVP2,
    Battlefield,
    Battlefield2,
    CoD1,
    CoD4,
    CoD5,
    DirectPlay,
    Doom3,
    ElDewrito,
    EOS,
    FiveM,
    Flatout2,
    GameSpy1,
    GameSpy2,
    GameSpy3,
    GameSpy4,
    Halo1,
    JediKnight,
    Kaillera,
    KillingFloor,
    Minecraft,
    Nadeo,
    Palworld,
    Quake1,
    Quake2,
    Quake3,
    RakNet,
    RenegadeX,
    Samp,
    Satisfactory,
    Scum,
    Source,
    SSC,
    SupCom,
    StrongholdCE,
    StrongholdCrusader,
    TeamSpeak3,
    TrackmaniaNations,
    Toxikk,
    UDK,
    Unreal2,
    UT3,
    Vcmp,
    W40kDow,
    Warcraft3,
    WON,
)

Requirements

  • Python 3.9 or higher

Installation

The recommended installation method is using pip:

pip install --upgrade opengsq

Usage

Here’s an example of how to query a server using the Source protocol:

import asyncio
from opengsq.protocols import Source

async def main():
    source = Source(host='45.147.5.5', port=27015)
    info = await source.get_info()
    print(info)

asyncio.run(main())

You can also use the Source Remote Console:

import asyncio
from opengsq.exceptions import AuthenticationException
from opengsq.rcon_protocols.source_rcon import SourceRcon

async def main():
    with SourceRcon("123.123.123.123", 27015) as source_rcon:
        try:
            await source_rcon.authenticate("serverRconPassword")
        except AuthenticationException:
            print('Failed to authenticate')

        response = await source_rcon.send_command("cvarlist")
        print(response)

asyncio.run(main())

Command-line interface

This library additionally provides an opengsq command-line utility which makes it easy to query game servers from your terminal. Run opengsq -h for usage.

# query server using source protocol
opengsq source --host 123.123.123.123 --port 27015 --function get_info

Tests and Results

You can find information about tests and results at https://python.opengsq.com/tests/protocols

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues.

https://github.com/opengsq/opengsq-python/graphs/contributors

Stargazers over time

Stargazers over time

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opengsq-3.6.2.tar.gz (105.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opengsq-3.6.2-py3-none-any.whl (168.0 kB view details)

Uploaded Python 3

File details

Details for the file opengsq-3.6.2.tar.gz.

File metadata

  • Download URL: opengsq-3.6.2.tar.gz
  • Upload date:
  • Size: 105.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opengsq-3.6.2.tar.gz
Algorithm Hash digest
SHA256 3c61e3753db229eb45120143ef014eff1fea04c6dba74af3cd1ec7bb186c1550
MD5 470cf960060239ebc7728717c3f8b843
BLAKE2b-256 f66faf00885197b05f9fa4e9878c055f63500859e958d51f6af9ca63a75747fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for opengsq-3.6.2.tar.gz:

Publisher: python-publish.yml on opengsq/opengsq-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opengsq-3.6.2-py3-none-any.whl.

File metadata

  • Download URL: opengsq-3.6.2-py3-none-any.whl
  • Upload date:
  • Size: 168.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opengsq-3.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 35814ca9887fb58f1cdde9fe4ea673b97539d9cec9b4e179ba1b3d5f1c4e7029
MD5 b77ccc964ae607cd98e4f7f52e565088
BLAKE2b-256 b6fb0c8d13fae7e232e4d2003b42d8047353180d25c059913f2c073e05afaa01

See more details on using hashes here.

Provenance

The following attestation bundles were made for opengsq-3.6.2-py3-none-any.whl:

Publisher: python-publish.yml on opengsq/opengsq-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page