### Create a Dathost Server using Python Source: https://dathost.readthedocs.io/en/latest/_sources/examples.rst Demonstrates how to create a new Dathost game server, specifically a CS: GO server, using the `dathost` Python wrapper. It shows how to configure server settings like name, location, slots, tickrate, and then start the server. This example utilizes `ServerSettings` for configuration. ```python from dathost.settings import ServerSettings data, server = client.create_server( ServerSettings( name="CS: GO server", location="sydney", ).csgo( slots=5, game_token="", tickrate=128, rcon_password="" ) ) server.start() print(data.slots) ``` -------------------------------- ### Create a dathost Server Source: https://dathost.readthedocs.io/en/latest/examples Demonstrates how to create a new game server using the dathost wrapper. It configures server settings such as name, location, CS:GO specific parameters like slots, game token, tickrate, and RCON password. The example then starts the created server and prints its slot count. ```python from dathost.settings import ServerSettings data, server = client.create_server( ServerSettings( name="CS: GO server", location="sydney", ).csgo( slots=5, game_token="", tickrate=128, rcon_password="" ) ) server.start() print(data.slots) ``` -------------------------------- ### Install Dathost Python Wrapper via Pip Source: https://dathost.readthedocs.io/en/latest/_sources/index.rst This code snippet demonstrates how to install the Dathost unofficial Python wrapper using pip, the standard Python package installer. This is the recommended and most common method for users to get started with the library. ```Python pip3 install dathost ``` -------------------------------- ### Install Dathost Python Wrapper from Git Source: https://dathost.readthedocs.io/en/latest/index This command installs the Dathost Python wrapper directly from its GitHub repository using pip. Use this method to get the latest development version of the library, which might include features not yet available on PyPI. ```Shell pip3 install git+https://github.com/WardPearce/dathost.git ``` -------------------------------- ### API Documentation for dathost.server.awaiting.ServerAwaiting Class Source: https://dathost.readthedocs.io/en/latest/api Provides a comprehensive set of asynchronous methods for managing Dathost game servers, including starting, stopping, resetting, updating parameters, retrieving metrics, and managing files. ```APIDOC dathost.server.awaiting.ServerAwaiting: list_files(path: str = None, file_sizes: bool = False, deleted_files: bool = False) -> Iterator[Union[FileModel, AwaitingFile]] path: Path to use as root, by default None file_sizes: by default False deleted_files: Include deleted files in list, by default False Yields: FileModel: Holds details on a file. AwaitingFile: Used to interact with a file. ftp_reset() -> None Resets the FRP password. get() -> dathost.models.server.ServerModel Used to get details on server. Returns: Holds data on server. Return type: dathost.models.server.ServerModel metrics() -> dathost.models.metrics.MetricsModel Used to get server metrics. Returns: Holds details on server metrics. Return type: dathost.models.metrics.MetricsModel reset() -> None Used to reset the server. start(allow_host_reassignment: bool = True) -> None Used to start the server. Parameters: allow_host_reassignment: By default True stop() -> None Used to stop the server. sync() -> None Used to sync files from server to cache. update(settings: dathost.settings.ServerSettings) -> None Update servers paramters. Parameters: settings: Used to configure server. ``` -------------------------------- ### Install Dathost Python Wrapper via Pip Source: https://dathost.readthedocs.io/en/latest/index This command installs the Dathost Python wrapper from the Python Package Index (PyPI) using pip, the standard package installer for Python. This is the recommended method for obtaining the stable release of the library. ```Shell pip3 install dathost ``` -------------------------------- ### Create a Dathost Match using Python Source: https://dathost.readthedocs.io/en/latest/_sources/examples.rst Illustrates how to create a new match on an existing Dathost server using the `dathost` Python wrapper. It configures match settings including connection time and assigns players to team 1, team 2, and spectators using various Steam ID formats. The wrapper handles the conversion of different Steam ID formats automatically. ```python from dathost.settings import MatchSettings data, match = server.create_match( MatchSettings( connection_time=60, ).team_1( [ "[U:1:116962485]", 76561198017567105, "STEAM_0:1:186064092" ] ).team_2( [ "[U:1:320762620]", "STEAM_0:1:83437164", 76561198214871324 ] ).spectators( [ "[U:1:320762620]", "STEAM_0:1:83437164", 76561198214871324 ] ) ) ``` -------------------------------- ### Install Dathost Python Wrapper from Git Source: https://dathost.readthedocs.io/en/latest/_sources/index.rst This snippet shows how to install the Dathost unofficial Python wrapper directly from its GitHub repository. This method is useful for developers who want to install the latest unreleased version or contribute to the project. ```Python pip3 install git+https://github.com/WardPearce/dathost.git ``` -------------------------------- ### Create a dathost Match Source: https://dathost.readthedocs.io/en/latest/examples Illustrates how to create a match on an existing server using the dathost wrapper. It sets a connection time and assigns players to team 1, team 2, and spectators using various Steam ID formats (U:1:ID, 64-bit Steam ID, STEAM_0:1:ID). The wrapper handles the conversion of different Steam ID formats automatically. ```python from dathost.settings import MatchSettings data, match = server.create_match( MatchSettings( connection_time=60, ).team_1( [ "[U:1:116962485]", 76561198017567105, "STEAM_0:1:186064092" ] ).team_2( [ "[U:1:320762620]", "STEAM_0:1:83437164", 76561198214871324 ] ).spectators( [ "[U:1:320762620]", "STEAM_0:1:83437164", 76561198214871324 ] ) ) # Don't worry about steam IDs, the wrapper # ensures they're all converted correctly. ``` -------------------------------- ### Initialize and Close dathost Awaiting Client (Non-Context Manager) Source: https://dathost.readthedocs.io/en/latest/_sources/intro.rst Demonstrates how to initialize an asynchronous dathost client with email and password, and explicitly close it after use. This method does not utilize a context manager, requiring manual client closure. ```python import dathost client = dathost.Awaiting( email="wardpearce@protonmail.com", password="..." ) # A client should always be closed after being used! await client.close() ``` -------------------------------- ### Initialize dathost Blocking Client with Context Manager Source: https://dathost.readthedocs.io/en/latest/_sources/intro.rst Shows how to use the synchronous dathost client as a context manager. This pattern ensures proper resource management, automatically closing the client upon exiting the 'with' block, even if errors occur. ```python import dathost with dathost.Blocking(EMAIL, PASSWORD) as client: pass ``` -------------------------------- ### Initialize and Close dathost Blocking Client (Non-Context Manager) Source: https://dathost.readthedocs.io/en/latest/_sources/intro.rst Demonstrates how to initialize a synchronous dathost client with email and password, and explicitly close it after use. This method does not utilize a context manager, requiring manual client closure. ```python import dathost client = dathost.Blocking( email="wardpearce@protonmail.com", password="..." ) # A client should always be closed after being used! client.close() ``` -------------------------------- ### Initialize and Close dathost Synchronous Client Source: https://dathost.readthedocs.io/en/latest/intro This example shows how to instantiate the `dathost.Blocking` client for synchronous operations. Similar to the asynchronous client, it emphasizes the need to call `client.close()` to properly shut down the client and free up resources. ```Python import dathost client = dathost.Blocking( email="wardpearce@protonmail.com", password="..." ) # A client should always be closed after being used! client.close() ``` -------------------------------- ### Initialize dathost Awaiting Client with Async Context Manager Source: https://dathost.readthedocs.io/en/latest/_sources/intro.rst Shows how to use the asynchronous dathost client as an async context manager. This pattern ensures proper resource management, automatically closing the client upon exiting the 'async with' block, even if errors occur. ```python import dathost async with dathost.Awaiting(EMAIL, PASSWORD) as client: pass ``` -------------------------------- ### dathost API Reference: P and R Sections Source: https://dathost.readthedocs.io/en/latest/genindex This section lists API attributes, methods, and classes from the `dathost` library, specifically those starting with 'P' and 'R'. It provides a quick overview of server configuration, game match statistics, file management, and account roles, detailing the name, type, and full module path for each API element. ```APIDOC P: password (Attribute): dathost.models.server.TeamFortressModel password (Attribute): dathost.models.server.ValheimModel path (Attribute): dathost.models.file.FileModel PlayerModel (Class): dathost.models.metrics players (Attribute): dathost.models.match.TeamModel players() (Method): dathost.models.match.MatchModel players_online (Attribute): dathost.models.server.ServerModel players_online() (Method): dathost.models.metrics.MetricsModel players_online_graph() (Method): dathost.models.metrics.MetricsModel PlayersOnlineGraphModel (Class): dathost.models.metrics playwin (Attribute): dathost.models.match.MatchModel playwin() (Method): dathost.settings.MatchSettings playwin_result (Attribute): dathost.models.match.MatchModel playwin_webhook (Attribute): dathost.models.match.MatchModel plus (Attribute): dathost.models.server.ValheimModel ports (Attribute): dathost.models.server.ServerModel PortsModel (Class): dathost.models.server prefer_dedicated (Attribute): dathost.models.server.ServerModel R: raw_ip (Attribute): dathost.models.server.ServerModel rcon (Attribute): dathost.models.server.TeamFortressModel reboot_on_crash (Attribute): dathost.models.server.ServerModel repeat (Attribute): dathost.models.server.ScheduledCommandsModel reset() (Method): dathost.server.awaiting.ServerAwaiting reset() (Method): dathost.server.blocking.ServerBlocking restore() (Method): dathost.server.awaiting.backup.AwaitingBackup restore() (Method): dathost.server.blocking.backup.BlockingBackup roles (Attribute): dathost.models.account.AccountModel round_end_webhook (Attribute): dathost.models.match.MatchModel rounds_played (Attribute): dathost.models.match.MatchModel run_at (Attribute): dathost.models.server.ScheduledCommandsModel ``` -------------------------------- ### dathost API Reference Index - B & C Sections Source: https://dathost.readthedocs.io/en/latest/genindex This section provides an indexed list of dathost API elements, including methods, attributes, and classes, organized alphabetically by their starting letter. Each entry specifies the full path to the API component and its type (method, attribute, or class). ```APIDOC B: dathost.server.awaiting.ServerAwaiting.backup() - Method dathost.server.blocking.ServerBlocking.backup() - Method dathost.models.backup.BackupModel.backup_name - Attribute dathost.models.backup.BackupModel - Class dathost.server.awaiting.ServerAwaiting.backups() - Method dathost.server.blocking.ServerBlocking.backups() - Method dathost.exceptions.BadRequest - Class dathost.Blocking - Class dathost.server.blocking.backup.BlockingBackup - Class dathost.server.blocking.file.BlockingFile - Class dathost.match.blocking.BlockingMatch - Class dathost.models.server.ServerModel.booting - Attribute C: dathost.models.match.MatchModel.cancel_reason - Attribute dathost.Awaiting.close() - Method dathost.Blocking.close() - Method dathost.models.server.ScheduledCommandsModel.command - Attribute dathost.models.server.ServerModel.confirmed - Attribute dathost.models.account.AccountModel.confirmed_at - Attribute dathost.models.match.MatchModel.connect_time - Attribute dathost.server.awaiting.ServerAwaiting.console_retrive() - Method dathost.server.blocking.ServerBlocking.console_retrive() - Method dathost.server.awaiting.ServerAwaiting.console_send() - Method dathost.server.blocking.ServerBlocking.console_send() - Method dathost.models.server.ServerModel.core_dump - Attribute dathost.models.server.ServerModel.cost_per_hour - Attribute dathost.server.awaiting.ServerAwaiting.create_match() - Method dathost.server.blocking.ServerBlocking.create_match() - Method dathost.Awaiting.create_server() - Method dathost.Blocking.create_server() - Method dathost.models.account.AccountModel.credits - Attribute dathost.models.server.ServerModel.csgo - Attribute dathost.settings.ServerSettings.csgo() - Method dathost.models.server.ServerModel.custom_domain - Attribute ``` -------------------------------- ### dathost API Elements: T-W Source: https://dathost.readthedocs.io/en/latest/genindex A comprehensive list of dathost API components, including models, settings, and server-related classes, along with their attributes and methods, organized by their fully qualified names. This section covers elements whose names start with T, U, V, or W. ```APIDOC dathost.models.match.MatchModel: team_1 (attribute) team_1_coach (attribute) team_2 (attribute) team_2_coach (attribute) wait_for_coaches (attribute) wait_for_spectators (attribute) warmup_time (attribute) dathost.settings.MatchSettings: team_1() (method) team_2() (method) webhook() (method) dathost.models.match.TeamModel (class) dathost.models.server.ServerModel: teamfortress (attribute) teamspeak (attribute) user_data (attribute) valheim (attribute) dathost.models.server.TeamFortressModel (class) dathost.models.server.TeamspeakModel (class) dathost.settings.ServerSettings: teamspeak() (method) tf2() (method) valheim() (method) dathost.models.account.AccountModel: time_left (attribute) trial (attribute) dathost.models.backup.BackupModel: timestamp (attribute) dathost.models.metrics.PlayersOnlineGraphModel: timestamp (attribute) value (attribute) dathost.server.awaiting.file.AwaitingFile: unzip() (method) upload() (method) upload_file() (method) dathost.server.blocking.file.BlockingFile: unzip() (method) upload() (method) upload_file() (method) dathost.server.awaiting.ServerAwaiting: update() (method) dathost.server.blocking.ServerBlocking: update() (method) dathost.models.server.ValheimModel (class): world_name (attribute) ``` -------------------------------- ### Use dathost Asynchronous Client as Context Manager Source: https://dathost.readthedocs.io/en/latest/intro This example demonstrates how to use `dathost.Awaiting` as an asynchronous context manager with the `async with` statement. This pattern is ideal for asynchronous operations, ensuring the client is correctly opened and closed without explicit `await client.close()` calls. ```Python import dathost async with dathost.Awaiting(EMAIL, PASSWORD) as client: pass ``` -------------------------------- ### dathost API Index - Section A Source: https://dathost.readthedocs.io/en/latest/genindex This snippet provides an indexed list of API elements from the dathost library, specifically those starting with the letter 'A'. Each entry specifies the element's name, type (attribute, method, or class), and its full module path. ```APIDOC API Index - A: - accepted_terms_of_service_version (attribute) in dathost.models.account.AccountModel - account() (method) in dathost.Awaiting - account() (method) in dathost.Blocking - account_id (attribute) in dathost.models.account.AccountModel - AccountModel (class) in dathost.models.account - action (attribute) in dathost.models.server.ScheduledCommandsModel - added_voice_server (attribute) in dathost.models.server.ServerModel - admin_token (attribute) in dathost.models.server.TeamspeakModel - admins (attribute) in dathost.models.server.TeamFortressModel - admins (attribute) in dathost.models.server.ValheimModel - affiliate (attribute) in dathost.models.account.AccountModel - all_time_players() (method) in dathost.models.metrics.MetricsModel - assists (attribute) in dathost.models.match.MatchPlayerModel - autostop (attribute) in dathost.models.server.ServerModel - autostop_minutes (attribute) in dathost.models.server.ServerModel - Awaiting (class) in dathost - AwaitingBackup (class) in dathost.server.awaiting.backup - AwaitingFile (class) in dathost.server.awaiting.file - AwaitingMatch (class) in dathost.match.awaiting - AwaitingOnly (class) in dathost.exceptions ``` -------------------------------- ### dathost.settings.ServerSettings Class API Reference Source: https://dathost.readthedocs.io/en/latest/settings Detailed API documentation for the `ServerSettings` class, which allows for the configuration of various server types. It outlines the constructor parameters, method-specific parameters, return types, and potential exceptions for game-specific settings like CS:GO and TeamSpeak. ```APIDOC class dathost.settings.ServerSettings: __init__( name: Optional[str] = None, location: Optional[str] = None, custom_domain: Optional[str] = None, autostop: Optional[bool] = None, autostop_minutes: Optional[int] = None, mysql: Optional[bool] = None, scheduled_commands: Optional[List[str]] = None, user_data: Optional[str] = None, reboot_on_crash: Optional[bool] = None, max_disk_usage_gb: Optional[int] = None, manual_sort_order: Optional[int] = None, core_dump: Optional[bool] = None, prefer_dedicated: Optional[bool] = None ) ``` ```APIDOC csgo( slots: Optional[int] = None, tickrate: Optional[int] = None, game_token: Optional[str] = None, rcon_password: Optional[str] = None, game_mode: Optional[str] = None, autoload_configs: Optional[List[str]] = None, disable_bots: bool = False, workshop_start_map_id: Optional[int] = None, csay_plugin: bool = False, gotv: bool = False, sourcemod: bool = False, insecure: bool = False, map_group: Optional[str] = None, start_map: Optional[str] = None, password: Optional[str] = None, pure: bool = True, admins: Optional[List[Any]] = None, plugins: Optional[List[Any]] = None, steam_key: Optional[str] = None, workshop_id: Optional[int] = None, maps_source: Optional[str] = None ) -> dathost.settings.ServerSettings Description: Used for configuring a CS: GO server. Parameters: slots (int): game_token (str): tickrate (int): game_mode (str, optional): by default None autoload_configs (List[str], optional): by default None disable_bots (bool, optional): by default False csay_plugin (bool, optional): by default False gotv (bool, optional): by default False sourcemod (bool, optional): by default False insecure (bool, optional): by default False map_group (str, optional): by default None start_map (str, optional): by default None password (str, optional): by default None pure (bool, optional): by default True rcon_password (str, optional): by default None admins (List[Any], optional): by default None plugins (List[Any], optional): by default None steam_key (str, optional): by default None workshop_id (int, optional): by default None workshop_start_map_id (int, optional): by default None maps_source (int, optional): by default None Raises: MultipleGames: Raised when you attempt to create one server with multiple games. InvalidSlotSize: Raised when slot size is below 5 or above 64. InvalidTickrate: Raised when tickrate is invalid. ``` ```APIDOC teamspeak( slots: int ) -> dathost.settings.ServerSettings Description: Used for configuring a teamspeak server. Parameters: slots (int): Raises: MultipleGames: Raised when you attempt to create one server with multiple games. InvalidSlotSize: Raised when slot size is below 5 or above 500. ``` -------------------------------- ### dathost.server.awaiting.ServerAwaiting Class API Reference Source: https://dathost.readthedocs.io/en/latest/api Detailed API documentation for the `dathost.server.awaiting.ServerAwaiting` class, providing methods to interact with server backups, console, matches, files, and server management. ```APIDOC class dathost.server.awaiting.ServerAwaiting: description: Used to interact with a server. methods: backup(backup_name: str) -> dathost.server.awaiting.backup.AwaitingBackup: description: Used to interact with a backup. parameters: backup_name (str): Name of backup. returns: dathost.server.awaiting.backup.AwaitingBackup async for backups() -> AsyncGenerator[Tuple[dathost.models.backup.BackupModel, dathost.server.awaiting.backup.AwaitingBackup], None]: description: Used to list backups a server has. yields: BackupModel: Holds details on backup. AwaitingBackup: Used for interacting with a backup. await console_retrive(lines: int = 1000) -> list: description: Used to retrive lines from the console. parameters: lines (int, optional): Amount of lines to retrive, by default 1000 returns: list: List of strings. raises: InvalidConsoleLine: Raised when console lines below 1 or above 100000. await console_send(line: str) -> None: description: Used to send a rcon command to console. parameters: line (str): Console command. await create_match(match_settings: dathost.settings.MatchSettings) -> Tuple[dathost.models.match.MatchModel, dathost.match.awaiting.AwaitingMatch]: description: Creates a match. parameters: match_settings (MatchSettings): Holds details on the match. returns: MatchModel: Holds match details. AwaitingMatch: Used to interact with a match. await delete() -> None: description: Used to delete a sever. await duplicate(sync: bool = False) -> Tuple[dathost.models.server.ServerModel, dathost.server.awaiting.ServerAwaiting]: description: Used to duplicate a server. parameters: sync (bool): Used to force update server cache, by default False returns: ServerModel: Holds server data. ServerAwaiting: Used to interact with server. file(pathway: str) -> dathost.server.awaiting.file.AwaitingFile: description: Used to interact with a file on the server. parameters: pathway (str): Pathway of file on server. returns: dathost.server.awaiting.file.AwaitingFile async for files(hide_default: bool = False, path: Optional[str] = None, file_sizes: bool = False, deleted_files: bool = False) -> AsyncGenerator[Tuple[dathost.models.file.FileModel, dathost.server.awaiting.file.AwaitingFile], None]: description: Used to list files. parameters: hide_default (bool, optional): by default False ``` -------------------------------- ### dathost.settings.MatchSettings Class API Reference Source: https://dathost.readthedocs.io/en/latest/settings Detailed API documentation for the `MatchSettings` class, including its constructor and methods for configuring game match parameters like connection time, spectator settings, team players, and webhooks. ```APIDOC class dathost.settings.MatchSettings __init__(connection_time: int = 300, knife_round: bool = False, wait_for_spectators: bool = True, enable_pause: bool = False, enable_ready: bool = False, enable_tech_pause: bool = False, ready_min_players: int = 1, wait_for_coaches: bool = True, warmup_time: int = 15) parameters: connection_time (int, optional): default 300 knife_round (bool, optional): default False wait_for_spectators (bool, optional): default True enable_pause (bool, optional): default False enable_ready (bool, optional): default False enable_tech_pause (bool, optional): default False ready_min_players (int, optional): default 1 wait_for_coaches (bool, optional): default True warmup_time (int, optional): default 15 playwin(webhook: Optional[str] = None) -> dathost.settings.MatchSettings description: Enables playwin AC. parameters: webhook (str, optional): Webhook to push playwin results, by default None returns: dathost.settings.MatchSettings spectators(players: list) -> dathost.settings.MatchSettings description: Spectators parameters: players (list): List of spectator steam IDs, steamID 64, 32 & u are supported. returns: dathost.settings.MatchSettings team_1(players: list, coach: Optional[Union[str, int]] = None) -> dathost.settings.MatchSettings description: Team 1 players parameters: players (list): List of spectator steam IDs, steamID 64, 32 & u are supported. coach (Union[str, int]): Steam id of coach, by deafult None returns: dathost.settings.MatchSettings team_2(players: list, coach: Optional[Union[str, int]] = None) -> dathost.settings.MatchSettings description: Team 2 players parameters: players (list): List of spectator steam IDs, steamID 64, 32 & u are supported. coach (Union[str, int]): Steam id of coach, by deafult None returns: dathost.settings.MatchSettings webhook(match_end: str, round_end: str, authorization: Optional[str] = None) -> dathost.settings.MatchSettings description: Used to set webhooks. parameters: match_end (str): URL of match end webhook. round_end (str): URL of round end webhook. authorization (str, optional): by default None returns: dathost.settings.MatchSettings ``` -------------------------------- ### Initialize and Close dathost Asynchronous Client Source: https://dathost.readthedocs.io/en/latest/intro This snippet demonstrates how to create an instance of the `dathost.Awaiting` client for asynchronous operations. It highlights the importance of explicitly closing the client using `await client.close()` after use to release resources. ```Python import dathost client = dathost.Awaiting( email="wardpearce@protonmail.com", password="..." ) # A client should always be closed after being used! await client.close() ``` -------------------------------- ### dathost.Awaiting Class API Reference Source: https://dathost.readthedocs.io/en/latest/api Comprehensive API documentation for the `dathost.Awaiting` class, outlining its asynchronous methods for interacting with the Dathost platform. This includes details on parameters, return types, and descriptions for each function. ```APIDOC class dathost.Awaiting: await account() -> dathost.models.account.AccountModel Description: Gets account details Returns: Holds data on a account. Return type: AccountModel await close() -> None Description: Closes sessions await create_server(settings: dathost.settings.ServerSettings) -> Tuple[dathost.models.server.ServerModel, dathost.server.awaiting.ServerAwaiting] Description: Creates a new server. Parameters: settings (ServerSettings): Used to configure server. Returns: ServerModel: Holds data on server. ServerAwaiting: Used to interact with the created server. async for ... in domains() -> AsyncGenerator[str, None] Description: Used to list domains. Returns: List of domains. Return type: list match(match_id: str) -> dathost.match.awaiting.AwaitingMatch Description: Used to interact with a match. Parameters: match_id (str): Dathost Match ID. Returns: Return type: AwaitingMatch server(server_id: str) -> dathost.server.awaiting.ServerAwaiting Description: Used for interacting with a server. Parameters: server_id (str): Datahost server ID. Returns: Used to interact with the server. Return type: ServerAwaiting async for ... in servers() -> AsyncGenerator[Tuple[dathost.models.server.ServerModel, dathost.server.awaiting.ServerAwaiting], None] Description: Used to list servers. Yields: ServerModel: Holds data on server. ``` -------------------------------- ### dathost.Blocking Class API Reference Source: https://dathost.readthedocs.io/en/latest/api Detailed API documentation for the dathost.Blocking class, providing methods for account management, server creation, and interaction with matches and servers. ```APIDOC class dathost.Blocking: Description: Blocking client for Dathost API interactions. Methods: account() -> dathost.models.account.AccountModel Description: Gets account details. Returns: AccountModel: Holds data on a account. close() -> None Description: Closes sessions. create_server(settings: dathost.settings.ServerSettings) -> Tuple[dathost.models.server.ServerModel, dathost.server.blocking.ServerBlocking] Description: Creates a new server. Parameters: settings (dathost.settings.ServerSettings): Used to configure server. Returns: ServerModel: Holds data on server. ServerBlocking: Used to interact with the created server. domains() -> Generator[str, None, None] Description: Used to list domains. Returns: list: List of domains. match(match_id: str) -> dathost.match.blocking.BlockingMatch Description: Used to interact with a match. Parameters: match_id (str): Dathost Match ID. Returns: BlockingMatch: server(server_id: str) -> dathost.server.blocking.ServerBlocking Description: Used for interacting with a server. Parameters: server_id (str): Datahost server ID. Returns: ServerBlocking: Used to interact with the server. servers() -> Generator[Tuple[dathost.models.server.ServerModel, dathost.server.blocking.ServerBlocking], None, None] Description: Used to list servers. Yields: ServerModel: Holds data on server. ServerBlocking: Used to interact with server. ``` -------------------------------- ### API Documentation for dathost.server.awaiting.backup.AwaitingBackup Class Source: https://dathost.readthedocs.io/en/latest/api Provides asynchronous functionality for managing server backups, specifically for restoring a backup. ```APIDOC dathost.server.awaiting.backup.AwaitingBackup: restore() -> None Used to restore a backup. ``` -------------------------------- ### Match Settings Class API Documentation Source: https://dathost.readthedocs.io/en/latest/_sources/settings.rst Documents the `MatchSettings` class from `dathost.settings`, which defines configuration parameters specific to a match or game session within the dathost system. This entry indicates that all public members of the class are included in the generated documentation. ```APIDOC Class: dathost.settings.MatchSettings Description: Configuration settings for a match. Members: All public members are included. ``` -------------------------------- ### dathost.server.blocking.ServerBlocking Class API Reference Source: https://dathost.readthedocs.io/en/latest/api Detailed API documentation for the `dathost.server.blocking.ServerBlocking` class, providing methods to interact with dathost servers, including backup management, console operations, file handling, and server duplication. ```APIDOC class dathost.server.blocking.ServerBlocking: backup(backup_name: str) -> dathost.server.blocking.backup.BlockingBackup description: Used to interact with a backup. parameters: backup_name (str): Name of backup. returns: BlockingBackup backups() -> Generator[Tuple[dathost.models.backup.BackupModel, dathost.server.blocking.backup.BlockingBackup], None, None] description: Used to list backups a server has. yields: BackupModel: Holds details on backup. BlockingBackup: Used for interacting with a backup. console_retrive(lines: int = 1000) -> list description: Used to retrive lines from the console. parameters: lines (int, optional): Amount of lines to retrive, by default 1000 returns: list: List of strings. raises: InvalidConsoleLine: Raised when console lines below 1 or above 100000. console_send(line: str) -> None description: Used to send a command to console. parameters: line (str): Console command. create_match(match_settings: dathost.settings.MatchSettings) -> Tuple[dathost.models.match.MatchModel, dathost.match.blocking.BlockingMatch] description: Creates a match. parameters: match_settings (dathost.settings.MatchSettings): Holds details on the match. returns: MatchModel: Holds match details. BlockingMatch: Used to interact with a match. delete() -> None description: Used to delete a sever. duplicate(sync: bool = False) -> Tuple[dathost.models.server.ServerModel, dathost.server.blocking.ServerBlocking] description: Used to duplicate a server. parameters: sync (bool): Used to force update server cache, by default False returns: ServerModel: Holds server data. ServerBlocking: Used to interact with server. file(pathway: str) -> dathost.server.blocking.file.BlockingFile description: Used to interact with a file on the server. parameters: pathway (str): Pathway of file on server. returns: BlockingFile files(hide_default: bool = False, path: Optional[str] = None, file_sizes: bool = False, deleted_files: bool = False) -> Generator[Tuple[dathost.models.file.FileModel, dathost.server.blocking.file.BlockingFile], None, None] description: Used to list files. parameters: hide_default (bool, optional): by default False path (str, optional): Path to use as root, by default None ``` -------------------------------- ### ServerAwaiting file() Method Source: https://dathost.readthedocs.io/en/latest/genindex A method within the dathost.server.awaiting.ServerAwaiting class, providing access to file-related operations for a server. This is an asynchronous entry point. ```APIDOC dathost.server.awaiting.ServerAwaiting.file() ``` -------------------------------- ### Dathost ServerModel API Reference Source: https://dathost.readthedocs.io/en/latest/models Documents the properties and methods available for the Dathost ServerModel, including game-specific configurations, disk usage, reboot behavior, and scheduled command management. ```APIDOC class dathost.models.server.ServerModel: # Properties valheim: dathost.models.server.ValheimModel csgo: CsgoModel max_disk_usage_gb: int reboot_on_crash: bool core_dump: bool prefer_dedicated: bool # Methods for ... in scheduled_commands() -> Generator[dathost.models.server.ScheduledCommandsModel, None, None]: Lists scheduled commands. Yields: ScheduledCommandsModel – Holds data on scheduled commands. ``` -------------------------------- ### Configure Valheim Server Settings API Source: https://dathost.readthedocs.io/en/latest/settings API method to configure a Valheim game server. This allows setting the server password, world name, and a list of admin SteamIDs. It returns a ServerSettings object and can raise an exception if attempting to configure multiple games on a single server. ```APIDOC valheim( password: Optional[str] = None, world_name: Optional[str] = None, plus: Optional[bool] = None, admins: Optional[List[Any]] = None ) -> dathost.settings.ServerSettings Description: Used to configure valheim server. Parameters: password (str, optional, default=None): The server password. world_name (str, optional, default=None): The name of the Valheim world. plus (bool, optional, default=None): Unknown parameter, likely related to server features. admins (List[Any], optional, default=None): List of SteamIDs in any format. Returns: dathost.settings.ServerSettings: Server settings object. Raises: MultipleGames: Raised when attempting to create one server with multiple games. ``` -------------------------------- ### Define dathost.settings.MatchSettings Class Source: https://dathost.readthedocs.io/en/latest/genindex Defines the 'MatchSettings' class within dathost.settings. This class encapsulates various configuration options and parameters for game matches. ```APIDOC dathost.settings.MatchSettings (class) ``` -------------------------------- ### Dathost Backup Model API Source: https://dathost.readthedocs.io/en/latest/_sources/models.rst API documentation for the Dathost Backup model, detailing server backup configurations and related data. ```APIDOC class dathost.models.backup.BackupModel ``` -------------------------------- ### dathost.server.blocking.backup.BlockingBackup API Reference Source: https://dathost.readthedocs.io/en/latest/api Documents the BlockingBackup class, providing methods to manage server backups. ```APIDOC Class: dathost.server.blocking.backup.BlockingBackup Method: restore() Description: Used to restore a backup. Returns: None ``` -------------------------------- ### Use dathost Synchronous Client as Context Manager Source: https://dathost.readthedocs.io/en/latest/intro This snippet illustrates the use of `dathost.Blocking` as a Python context manager. By using the `with` statement, the client is automatically initialized and closed, simplifying resource management and ensuring proper cleanup even if errors occur. ```Python import dathost with dathost.Blocking(EMAIL, PASSWORD) as client: pass ``` -------------------------------- ### Dathost Match Models API Reference Source: https://dathost.readthedocs.io/en/latest/models Comprehensive API documentation for the dathost.models.match module, covering the MatchModel, MatchPlayerModel, and TeamModel classes. It describes their properties, types, and methods for interacting with match-related data. ```APIDOC class dathost.models.match.MatchModel: Description: Holds match details. Properties: match_id: str server_id: str connect_time: int round_end_webhook: str match_end_webhook: str finished: bool cancel_reason: str rounds_played: int spectators: list team_1: dathost.models.match.TeamModel team_2: dathost.models.match.TeamModel knife_round: bool playwin: bool playwin_webhook: str playwin_result: dict warmup_time: int wait_for_spectators: bool enable_pause: bool enable_ready: bool enable_tech_pause: bool team_1_coach: str team_2_coach: str wait_for_coaches: bool Methods: players() -> Generator[dathost.models.match.MatchPlayerModel, None, None]: Description: Used to list players. Yields: PlayerModel – Holds details on player. class dathost.models.match.MatchPlayerModel: Description: Holds match player details. Properties: steamid: str kills: int deaths: int assists: int kdr: float class dathost.models.match.TeamModel: Description: Holds details on team. Properties: score: int players: list ``` -------------------------------- ### API Documentation for dathost.server.blocking.file.BlockingFile Source: https://dathost.readthedocs.io/en/latest/api Detailed API reference for the `BlockingFile` class, outlining its methods for managing files. This includes operations like deleting, downloading (both to memory and iteratively), moving, saving to a local path, unzipping, and uploading raw bytes or local files. ```APIDOC class dathost.server.blocking.file.BlockingFile: delete() -> None Description: Deletes file. dowload() -> bytes Description: Used to download a file into memory. Returns: bytes Notes: Its reccomened to use download_iterate for large files. download_iterate() -> None Description: Raises: dathost.exceptions.AwaitingOnly – This function is meant only for awaiting code. move(destination: str) -> None Description: Used for moving a file. Parameters: destination (str): Notes: When called the file_path changes to the given destination. save(local_pathway: str) -> None Description: Saves file to local pathway. Parameters: local_pathway (str): Pathway to save file to. unzip(destination: str) -> None Description: Used to unzip a file. Parameters: destination (str): upload(data: bytes) -> None Description: Used for uploading raw bytes. Parameters: data (bytes): Data to upload. upload_file(local_pathway: str) -> None Description: Used to upload a local file. Parameters: local_pathway (str): Local file to upload. ``` -------------------------------- ### API Documentation for dathost.match.awaiting.AwaitingMatch Class Source: https://dathost.readthedocs.io/en/latest/api Defines asynchronous methods for retrieving details about a match within the Dathost system. ```APIDOC dathost.match.awaiting.AwaitingMatch: get() -> dathost.models.match.MatchModel Gets details on a match Returns: Holds match details. Return type: dathost.models.match.MatchModel ``` -------------------------------- ### Dathost Match Related Models API Source: https://dathost.readthedocs.io/en/latest/_sources/models.rst API documentation for models related to matches, including general match details, player-specific information within a match, and team configurations. ```APIDOC class dathost.models.match.MatchModel class dathost.models.match.MatchPlayerModel class dathost.models.match.TeamModel ``` -------------------------------- ### Call dathost.server.awaiting.file.AwaitingFile.move() Method Source: https://dathost.readthedocs.io/en/latest/genindex Provides a reference to the 'move()' method of the dathost.server.awaiting.file.AwaitingFile class. This method is used for asynchronously moving files on the server. ```APIDOC dathost.server.awaiting.file.AwaitingFile.move() (method) ```