Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BattlefieldDuck committed Jan 26, 2024
1 parent 459bf79 commit 6679f26
Show file tree
Hide file tree
Showing 157 changed files with 89,120 additions and 92,087 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 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)
[![](https://img.shields.io/pypi/v/opengsq.svg)](https://pypi.org/project/opengsq/)
Expand All @@ -9,6 +10,7 @@ The OpenGSQ Python library provides a convenient way to query servers
from applications written in the Python language.

## Supported Protocols

```py
from opengsq.protocols.ase import ASE
from opengsq.protocols.battlefield import Battlefield
Expand Down Expand Up @@ -37,7 +39,7 @@ from opengsq.protocols.won import WON

## Requirements

- Python 3.6+
- Python 3.6+

## Installation

Expand All @@ -55,7 +57,8 @@ python setup.py install

## Usage

Query server using Source, example output: [tests/results/test_source/test_get_info.json](/tests/results/test_source/test_get_info.json)
Here’s an example of how to query a server using the Source protocol:

```py
import asyncio
from opengsq.protocols import Source
Expand All @@ -68,21 +71,22 @@ async def main():
asyncio.run(main())
```

Rcon server using Source Remote Console, example output: [tests/results/test_source/test_remote_console.txt](/tests/results/test_source/test_remote_console.txt)
You can also use the Source Remote Console:

```py
import asyncio

from opengsq.exceptions import AuthenticationException
from opengsq.protocols import Source
from opengsq.rcon_protocols.source_rcon import SourceRcon

async def main():
with Source.RemoteConsole('123.123.123.123', 27015) as rcon:
with SourceRcon("123.123.123.123", 27015) as source_rcon:
try:
await rcon.authenticate('serverRconPassword')
result = await rcon.send_command('cvarlist')
print(result)
await source_rcon.authenticate("serverRconPassword")
except AuthenticationException:
print('Fail to authenticate')
print('Failed to authenticate')

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

asyncio.run(main())
```
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Welcome to OpenGSQ Python's documentation!
:maxdepth: 4
:caption: Tests

tests/protocols/index
tests/rcon_protocols/index


Indices and tables
==================
Expand Down
29 changes: 29 additions & 0 deletions docs/tests/protocols/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. _tests:

Protocols Tests
===============

.. toctree::
test_ase/index
test_battlefield/index
test_doom3/index
test_eos/index
test_fivem/index
test_gamespy1/index
test_gamespy2/index
test_gamespy3/index
test_gamespy4/index
test_killingfloor/index
test_minecraft/index
test_quake1/index
test_quake2/index
test_quake3/index
test_raknet/index
test_samp/index
test_satisfactory/index
test_scum/index
test_source/index
test_teamspeak3/index
test_unreal2/index
test_vcmp/index
test_won/index
7 changes: 7 additions & 0 deletions docs/tests/protocols/test_ase/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _test_ase:

test_ase
========

.. toctree::
test_get_status
27 changes: 27 additions & 0 deletions docs/tests/protocols/test_ase/test_get_status.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
test_get_status
===============

Here are the results for the test method.

.. code-block:: json
{
"game_name": "mta",
"game_port": 22003,
"hostname": "MTA Türkiye ✖ GÜL GAMİNG FREEROAM ✖ [Roleplay/Askeri/Drift/Drop/Turkey/Tr/Gül Gaming]",
"game_type": "BEDAVA - VIP",
"map": "None",
"version": "1.6",
"password": false,
"num_players": 51,
"max_players": 120,
"rules": {},
"players": {
"name": "LEO10",
"team": "",
"skin": "",
"score": 0,
"ping": 63,
"time": 0
}
}
9 changes: 9 additions & 0 deletions docs/tests/protocols/test_battlefield/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _test_battlefield:

test_battlefield
================

.. toctree::
test_get_info
test_get_players
test_get_version
37 changes: 37 additions & 0 deletions docs/tests/protocols/test_battlefield/test_get_info.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
test_get_info
=============

Here are the results for the test method.

.. code-block:: json
{
"hostname": "# -bZ4- # 60HZ LOCKER NO RULES BANZORE.COM",
"num_players": 54,
"max_players": 64,
"game_type": "ConquestLarge0",
"map": "MP_Prison",
"rounds_played": 0,
"rounds_total": 1,
"teams": [
1151.0,
1093.25293
],
"target_score": 0,
"status": "",
"ranked": true,
"punk_buster": true,
"password": false,
"uptime": 64126,
"round_time": 224,
"mod": null,
"ip_port": "74.91.124.140:25200",
"punk_buster_version": "v1.905 | A1390 C2.351",
"join_queue": true,
"region": "NAm",
"ping_site": "iad",
"country": "US",
"blaze_player_count": 61,
"blaze_game_state": "IN_GAME",
"quick_match": null
}
Loading

0 comments on commit 6679f26

Please sign in to comment.