Metadata-Version: 2.4
Name: opengsq
Version: 3.6.2
Summary: 🐍 OpenGSQ - Python library for querying game servers
Home-page: https://github.com/opengsq/opengsq-python
Author: OpenGSQ
License: MIT
Project-URL: Bug Tracker, https://github.com/opengsq/opengsq-python/issues
Project-URL: Source Code, https://github.com/opengsq/opengsq-python
Project-URL: Documentation, https://python.opengsq.com/
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp<4,>=3.7.4
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# OpenGSQ Python Library

[![Python Package](https://github.com/opengsq/opengsq-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/opengsq/opengsq-python/actions/workflows/python-package.yml)
[![GitHub license](https://img.shields.io/github/license/opengsq/opengsq-python)](https://github.com/opengsq/opengsq-python/blob/main/LICENSE)
[![PyPI version](https://img.shields.io/pypi/v/opengsq.svg)](https://pypi.org/project/opengsq/)
[![Python versions](https://img.shields.io/pypi/pyversions/opengsq.svg)](https://pypi.org/project/opengsq/)
[![Downloads](https://pepy.tech/badge/opengsq)](https://pepy.tech/project/opengsq)

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:

```py
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](http://pip-installer.org/):

```sh
pip install --upgrade opengsq
```

## Usage

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

```py
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:

```py
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.

```sh
# 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](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](https://contrib.rocks/image?repo=opengsq/opengsq-python)

## Stargazers over time

[![Stargazers over time](https://starchart.cc/opengsq/opengsq-python.svg?variant=adaptive)](https://starchart.cc/opengsq/opengsq-python)
