opengsq.protocols package

Submodules

opengsq.protocols.ase module

class opengsq.protocols.ase.ASE(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the All-Seeing Eye Protocol. It provides methods to interact with the All-Seeing Eye API.

full_name = 'All-Seeing Eye Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server.

This method sends a request to the server and parses the response to create a Status object.

Returns:

The status of the game server.

opengsq.protocols.battlefield module

class opengsq.protocols.battlefield.Battlefield(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Battlefield Protocol. It provides methods to interact with the Battlefield API.

full_name = 'Battlefield Protocol'
async get_info() Info

Asynchronously retrieves the information of the game server.

Returns:

An Info object containing the information of the game server.

async get_version() VersionInfo

Asynchronously retrieves the version information of the game server.

Returns:

A VersionInfo object containing the version information of the game server.

async get_players() list[dict[str, str]]

Asynchronously retrieves the list of players on the game server.

Returns:

A list of dictionaries containing the player information.

opengsq.protocols.doom3 module

class opengsq.protocols.doom3.Doom3(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Doom3 Protocol. It provides methods to interact with the Doom3 API.

full_name = 'Doom3 Protocol'
async get_status(strip_color=True) Status

Asynchronously retrieves the status of the game server.

Parameters:

strip_color – A boolean indicating whether to strip color codes from the player names.

Returns:

A Status object containing the server information and player list.

This function sends a request to the game server and processes the response to extract server information and player details. If the ‘strip_color’ parameter is set to True, color codes in player names are removed. The function returns a Status object which includes a dictionary of server information and a list of players.

static strip_colors(text: str) str

Strips color codes from the given text.

Parameters:

text – The text to strip color codes from.

Returns:

The text with color codes stripped.

opengsq.protocols.eos module

class opengsq.protocols.eos.EOS(host: str, port: int, deployment_id: str, access_token: str, timeout: float = 5)

Bases: ProtocolBase

This class represents the Epic Online Services (EOS) Protocol. It provides methods to interact with the EOS API.

full_name = 'Epic Online Services (EOS) Protocol'
async static get_access_token(*, client_id: str, client_secret: str, deployment_id: str, grant_type: str, external_auth_type: str, external_auth_token: str) str

Retrieves the access token from the EOS service.

Parameters:
  • client_id – The client ID for the EOS service.

  • client_secret – The client secret for the EOS service.

  • deployment_id – The deployment ID for the EOS service.

  • grant_type – The grant type for the OAuth token.

  • external_auth_type – The external authentication type.

  • external_auth_token – The external authentication token.

Returns:

The access token.

async static get_external_auth_token(*, client_id: str, client_secret: str, external_auth_type: str) str

Retrieves the external authentication token from the EOS service.

Parameters:
  • client_id – The client ID for the EOS service.

  • client_secret – The client secret for the EOS service.

  • external_auth_type – The external authentication type.

Returns:

The external authentication token.

async static get_matchmaking(deployment_id: str, access_token: str, filter: dict = {}) Matchmaking

Retrieves the matchmaking data from the EOS service.

Parameters:
  • deployment_id – The deployment ID for the EOS service.

  • access_token – The access token for the EOS service.

  • filter – The filter for the matchmaking data.

Returns:

The matchmaking data.

async get_info() dict[str, Any]

Retrieves the matchmaking information for the current server.

This method first resolves the host to an IP address, then queries the matchmaking service with the IP address and port. If no matching sessions are found, it raises a ServerNotFoundException.

Returns:

The first matching session if any are found.

opengsq.protocols.fivem module

class opengsq.protocols.fivem.FiveM(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the FiveM Protocol (https://docs.fivem.net/docs/server-manual/proxy-setup/). It provides methods to interact with the FiveM API.

full_name = 'FiveM Protocol'
async get_info() dict[str, Any]

Asynchronously retrieves the information of the game server.

Returns:

A dictionary containing the information of the game server.

async get_players() list[dict[str, Any]]

Asynchronously retrieves the list of players on the game server.

Returns:

A list of players on the game server.

async get_dynamic() dict[str, Any]

Asynchronously retrieves the dynamic data of the game server.

Returns:

A dictionary containing the dynamic data of the game server.

opengsq.protocols.gamespy1 module

class opengsq.protocols.gamespy1.GameSpy1(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

GameSpy Protocol version 1

full_name = 'GameSpy Protocol version 1'
async get_basic() dict[str, str]

Asynchronously retrieves the basic information of the game server.

Returns:

A dictionary containing the basic information of the game server.

async get_info(xserverquery: bool = True) dict[str, str]

Asynchronously retrieves the information of the current game running on the server.

Parameters:

xserverquery – A boolean indicating whether to use XServerQuery.

Returns:

A dictionary containing the information of the current game.

async get_rules(xserverquery: bool = True) dict[str, str]

Asynchronously retrieves the rules of the current game running on the server.

Parameters:

xserverquery – A boolean indicating whether to use XServerQuery.

Returns:

A dictionary containing the rules of the current game.

async get_players(xserverquery: bool = True) list[dict[str, str]]

Asynchronously retrieves the information of each player on the server.

Parameters:

xserverquery – A boolean indicating whether to use XServerQuery.

Returns:

A list containing the information of each player.

async get_status(xserverquery: bool = True) Status

Asynchronously retrieves the status of the game server.

XServerQuery: infoxserverqueryrulesxserverqueryplayersxserverquery Old response: basicinforulesplayers

If the server uses XServerQuery, he sends you the new information, otherwise he’ll give you back the old information.

Parameters:

xserverquery – A boolean indicating whether to use XServerQuery.

Returns:

A Status object containing the status of the game server.

async get_teams() list[dict[str, str]]

Asynchronously retrieves the information of each team on the server.

Returns:

A list containing the information of each team.

opengsq.protocols.gamespy2 module

class opengsq.protocols.gamespy2.GameSpy2(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the GameSpy Protocol version 2. It provides methods to interact with the GameSpy API.

full_name = 'GameSpy Protocol version 2'
class Request(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Flag

INFO = 1
PLAYERS = 2
TEAMS = 4
async get_status(request: Request = Request.INFO | PLAYERS | TEAMS) Status

Asynchronously retrieves the status of the game server.

Parameters:

request – A Request object indicating the type of information to retrieve.

Returns:

A Status object containing the status of the game server.

opengsq.protocols.gamespy3 module

class opengsq.protocols.gamespy3.GameSpy3(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the GameSpy Protocol version 3. It provides methods to interact with the GameSpy API.

full_name = 'GameSpy Protocol version 3'
challenge_required = False
async get_status() Status

Asynchronously retrieves the status of the game server. The status includes information about the server, players, and teams.

Returns:

A Status object containing the status of the game server.

opengsq.protocols.gamespy4 module

class opengsq.protocols.gamespy4.GameSpy4(host: str, port: int, timeout: float = 5.0)

Bases: GameSpy3

This class represents the GameSpy Protocol version 4. It inherits from the GameSpy3 class and overrides some of its properties.

full_name = 'GameSpy Protocol version 4'
challenge_required = True

opengsq.protocols.kaillera module

class opengsq.protocols.kaillera.Kaillera(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

A class used to represent the Kaillera Network Protocol.

full_name = 'Kaillera Network Protocol'
async get_status() bool

Checks the status of the server by sending a PING message and expecting a PONG response.

Returns:

bool: True if the server responds with PONG, False otherwise.

async static query_master_servers() list[Status]

Queries the master servers for a list of all active servers.

Returns:

list[Status]: A list of Status objects representing each server.

opengsq.protocols.killingfloor module

class opengsq.protocols.killingfloor.KillingFloor(host: str, port: int, timeout: float = 5.0)

Bases: Unreal2

This class represents the Killing Floor Protocol. It provides methods to interact with the Killing Floor API.

full_name = 'Killing Floor Protocol'
async get_details(strip_color=True) Status

Asynchronously retrieves the details of the game server.

Args:

strip_color (bool, optional): If True, strips color codes from the server name. Defaults to True.

Returns:

A Status object containing the details of the game server.

opengsq.protocols.minecraft module

class opengsq.protocols.minecraft.Minecraft(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Minecraft Protocol. It provides methods to interact with the Minecraft API. (https://wiki.vg/Server_List_Ping)

full_name = 'Minecraft Protocol'
async get_status(version=47, strip_color=True) dict[str, Any]

Asynchronously retrieves the status of the game server.

Parameters:
  • version – The protocol version number. Defaults to 47.

  • strip_color – Whether to strip color from the response. Defaults to True.

Returns:

A dictionary containing the status of the game server.

async get_status_pre17(strip_color=True) StatusPre17

Asynchronously retrieves the status of a game server that uses a version older than Minecraft 1.7.

Parameters:

strip_color – Whether to strip color from the response. Defaults to True.

Returns:

A StatusPre17 object containing the status of the game server.

static strip_colors(text: str) get_status_pre17

Strips color codes from the given text.

Parameters:

text – The text to strip color codes from.

Returns:

The text with color codes stripped.

opengsq.protocols.quake1 module

class opengsq.protocols.quake1.Quake1(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Quake1 Protocol. It provides methods to interact with the Quake1 API.

full_name = 'Quake1 Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

opengsq.protocols.quake2 module

class opengsq.protocols.quake2.Quake2(host: str, port: int, timeout: float = 5.0)

Bases: Quake1

This class represents the Quake2 Protocol. It provides methods to interact with the Quake2 API.

full_name = 'Quake2 Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

opengsq.protocols.quake3 module

class opengsq.protocols.quake3.Quake3(host: str, port: int, timeout: float = 5.0)

Bases: Quake2

This class represents the Quake3 Protocol. It provides methods to interact with the Quake3 API.

full_name = 'Quake3 Protocol'
async get_info(strip_color=True) dict[str, str]

Asynchronously retrieves the information of the game server.

Parameters:

strip_color – A boolean indicating whether to strip color codes from the information.

Returns:

A dictionary containing the information of the game server.

async get_status(strip_color=True) Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

static strip_colors(text: str) str

Strips color codes from the given text.

Parameters:

text – The text to strip color codes from.

Returns:

The text with color codes stripped.

opengsq.protocols.raknet module

class opengsq.protocols.raknet.RakNet(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the RakNet Protocol. It provides methods to interact with the RakNet API. (https://wiki.vg/Raknet_Protocol)

full_name = 'RakNet Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

opengsq.protocols.samp module

class opengsq.protocols.samp.Samp(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the San Andreas Multiplayer Protocol. It provides methods to interact with the San Andreas Multiplayer API.

full_name = 'San Andreas Multiplayer Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

async get_players() list[Player]

Asynchronously retrieves the players of the game server. The server may not respond when the number of players is greater than 100.

Returns:

A list containing the players of the game server.

async get_rules() dict[str, str]

Asynchronously retrieves the rules of the game server.

Returns:

A dictionary containing the rules of the game server.

opengsq.protocols.satisfactory module

class opengsq.protocols.satisfactory.Satisfactory(host: str, port: int, app_token: str, timeout: float = 5)

Bases: ProtocolBase

This class represents the Satisfactory Protocol. It provides methods to interact with the Satisfactory Lightweight Query API.

full_name = 'Satisfactory Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server. The status includes the server state, name, player count and max player count. The server state can be one of the following: 0 - Offline (The server is offline. Servers will never send this as a response) 1 - Idle (The server is running, but no save is currently loaded) 2 - Loading (The server is currently loading a map. In this state, HTTPS API is unavailable) 3 - Playing (The server is running, and a save is loaded. Server is joinable by players)

Returns:

A Status object containing the status of the game server.

opengsq.protocols.scum module

class opengsq.protocols.scum.Scum(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Scum Protocol. It provides methods to interact with the Scum API.

full_name = 'Scum Protocol'
async get_status(master_servers: list[Status] = None) Status

Asynchronously retrieves the status of the game server. If the master_servers parameter is not passed, this method calls the Scum.query_master_servers() function every time it is invoked. You may need to cache the master servers if you have a lot of servers to query.

Parameters:

master_servers – A list of master servers. Defaults to None.

Returns:

A Status object containing the status of the game server.

async static query_master_servers() list[Status]

Asynchronously queries the SCUM Master-Server list.

Returns:

A list of Status objects containing the status of the master servers.

opengsq.protocols.source module

class opengsq.protocols.source.Source(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Source Engine Protocol. It provides methods to interact with the Source Engine API.

full_name = 'Source Engine Protocol'
async get_info() PartialInfo

Asynchronously retrieves information about the server including, but not limited to: its name, the map currently being played, and the number of players.

Returns:

A PartialInfo object containing the information about the server.

async get_players() list[Player]

Asynchronously retrieves information about the players currently on the server.

Returns:

A list of Player objects containing the information about the players.

async get_rules() dict[str, str]

Asynchronously retrieves the rules of the game server, or configuration variables in name/value pairs.

Returns:

A dictionary containing the rules of the game server.

opengsq.protocols.teamspeak3 module

class opengsq.protocols.teamspeak3.TeamSpeak3(host: str, port: int, voice_port: int, timeout: float = 5)

Bases: ProtocolBase

This class represents the TeamSpeak 3 Protocol. It provides methods to interact with the TeamSpeak 3 API.

full_name = 'TeamSpeak 3 Protocol'
async get_info() dict[str, str]

Asynchronously retrieves the information of the game server.

Returns:

A dictionary containing the information of the game server.

async get_clients() list[dict[str, str]]

Asynchronously retrieves the list of clients on the game server.

Returns:

A list of clients on the game server.

async get_channels() list[dict[str, str]]

Asynchronously retrieves the list of channels on the game server.

Returns:

A list of channels on the game server.

opengsq.protocols.unreal2 module

class opengsq.protocols.unreal2.Unreal2(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

The Unreal2 class inherits from the ProtocolBase class and represents the Unreal 2 Protocol. It provides methods to get details, rules, and players from a server using the Unreal 2 Protocol.

full_name = 'Unreal 2 Protocol'
async get_details(strip_color=True) Status

Asynchronously gets the details of a server.

Args:

strip_color (bool, optional): If True, strips color codes from the server name. Defaults to True.

Returns:

Status: A Status object containing the details of the server.

async get_rules(strip_color=True) dict[str, Any]

Asynchronously gets the rules of a server.

Args:

strip_color (bool, optional): If True, strips color codes. Defaults to True.

Returns:

dict: A dictionary containing the rules of the server.

async get_players(strip_color=True) list[Player]

Asynchronously gets the players of a server.

Args:

strip_color (bool, optional): If True, strips color codes. Defaults to True.

Returns:

list: A list of Player objects representing the players of the server.

static strip_color(text: bytes) bytes

Strips color codes from a string.

Args:

text (str): The string to strip color codes from.

Returns:

str: The string with color codes stripped.

opengsq.protocols.vcmp module

class opengsq.protocols.vcmp.Vcmp(host: str, port: int, timeout: float = 5.0)

Bases: ProtocolBase

This class represents the Vice City Multiplayer Protocol. It provides methods to interact with the Vice City Multiplayer API.

full_name = 'Vice City Multiplayer Protocol'
async get_status() Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

async get_players() list[Player]

Asynchronously retrieves the list of players on the game server.

Returns:

A list of Player objects representing the players on the game server.

opengsq.protocols.warfork module

class opengsq.protocols.warfork.Warfork(host: str, port: int, timeout: float = 5.0)

Bases: Quake3

This class represents the Quake3 Protocol for Warfork. It provides methods to interact with the Warfork API.

full_name = 'Warfork Protocol'
async get_status(strip_color=True) Status

Asynchronously retrieves the status of the game server.

Returns:

A Status object containing the status of the game server.

opengsq.protocols.won module

class opengsq.protocols.won.WON(host: str, port: int, timeout: float = 5.0)

Bases: Source

World Opponent Network (WON) Query Protocol

full_name = 'World Opponent Network (WON) Protocol'

Module contents