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 (
    ASE,
    Battlefield,
    Doom3,
    EOS,
    FiveM,
    GameSpy1,
    GameSpy2,
    GameSpy3,
    GameSpy4,
    Kaillera,
    KillingFloor,
    Minecraft,
    Quake1,
    Quake2,
    Quake3,
    RakNet,
    Samp,
    Satisfactory,
    Scum,
    Source,
    TeamSpeak3,
    Unreal2,
    Vcmp,
    WON,
)

Requirements

  • Python 3.7 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

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.1.0.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

opengsq-3.1.0-py3-none-any.whl (66.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opengsq-3.1.0.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for opengsq-3.1.0.tar.gz
Algorithm Hash digest
SHA256 b867456d07d91b4aced928534fdbd1603c611a52bd047da454f62e2f0d374075
MD5 65ee263aadf5b71ccf0d52f448660912
BLAKE2b-256 5badec92ff887f1da9bcdf75d09f2cd5c06353f70bdf56c3ffb52a9b92ca8e05

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opengsq-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 66.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for opengsq-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5dac5a68a70cdb473057c7ebf4eca5cbe1b01d17bd62e64209750cf19e94d622
MD5 24c15dfb8dc1282a4035a036b6bd7d7e
BLAKE2b-256 a9196b5888e45b8f26e894fffe80e4633d2cf51d1e6bb35a713e64a39ede46e7

See more details on using hashes here.

Supported by

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