API¶
Awaiting¶
- class dathost.Awaiting¶
- await account() dathost.models.account.AccountModel ¶
Gets account details
- Returns
Holds data on a account.
- Return type
- await close() None ¶
Closes sessions
- await create_server(settings: dathost.settings.ServerSettings) Tuple[dathost.models.server.ServerModel, dathost.server.awaiting.ServerAwaiting] ¶
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] ¶
Used to list domains.
- Returns
List of domains.
- Return type
list
- match(match_id: str) dathost.match.awaiting.AwaitingMatch ¶
Used to interact with a match.
- Parameters
match_id (str) – Dathost Match ID.
- Returns
- Return type
- server(server_id: str) dathost.server.awaiting.ServerAwaiting ¶
Used for interacting with a server.
- Parameters
server_id (str) – Datahost server ID.
- Returns
Used to interact with the server.
- Return type
- async for ... in servers() AsyncGenerator[Tuple[dathost.models.server.ServerModel, dathost.server.awaiting.ServerAwaiting], None] ¶
Used to list servers.
- Yields
ServerModel – Holds data on server.
Server¶
- class dathost.server.awaiting.ServerAwaiting¶
- backup(backup_name: str) dathost.server.awaiting.backup.AwaitingBackup ¶
Used to interact with a backup.
- Parameters
backup_name (str) – Name of backup.
- Returns
- Return type
- async for ... in backups() AsyncGenerator[Tuple[dathost.models.backup.BackupModel, dathost.server.awaiting.backup.AwaitingBackup], None] ¶
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 ¶
Used to retrive lines from the console.
- Parameters
lines (int, optional) – Amount of lines to retrive, by default 1000
- Returns
List of strings.
- Return type
list
- Raises
InvalidConsoleLine – Raised when console lines below 1 or above 100000.
- await console_send(line: str) None ¶
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] ¶
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 ¶
Used to delete a sever.
- await duplicate(sync: bool = False) Tuple[dathost.models.server.ServerModel, dathost.server.awaiting.ServerAwaiting] ¶
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 ¶
Used to interact with a file on the server.
- Parameters
pathway (str) – Pathway of file on server.
- Returns
- Return type
- async for ... in 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] ¶
Used to list files.
- Parameters
hide_default (bool, optional) – by default False
path (str, optional) – Path to use as root, by default None
file_sizes (bool, optional) – by default False
deleted_files (bool, optional) – Include deleted files in list, by default False
- Yields
FileModel – Holds details on a file.
AwaitingFile – Used to interact with a file.
- await ftp_reset() None ¶
Resets the FRP password.
- await get() dathost.models.server.ServerModel ¶
Used to get details on server.
- Returns
Holds data on server.
- Return type
- await metrics() dathost.models.metrics.MetricsModel ¶
Used to get server metrics.
- Returns
Holds details on server metrics.
- Return type
- await reset() None ¶
Used to reset the server.
- await start(allow_host_reassignment: bool = True) None ¶
Used to start the server.
- Parameters
allow_host_reassignment (bool, optional) – By default True
- await stop() None ¶
Used to stop the server.
- await sync() None ¶
Used to sync files from server to cache.
- await update(settings: dathost.settings.ServerSettings) None ¶
Update servers paramters.
- Parameters
settings (ServerSettings) – Used to configure server.
Match¶
- class dathost.match.awaiting.AwaitingMatch¶
- await get() dathost.models.match.MatchModel ¶
Gets details on a match
- Returns
Holds match details.
- Return type
Backup¶
File¶
- class dathost.server.awaiting.file.AwaitingFile¶
- await delete() None ¶
Deletes file.
- await dowload() bytes ¶
Used to download a file into memory.
- Returns
- Return type
bytes
Notes
Its reccomened to use download_iterate for large files.
- async for ... in download_iterate() AsyncGenerator[bytes, None] ¶
Asynchronously downloads data into memory.
- Yields
bytes
- await move(destination: str) None ¶
Used for moving a file.
- Parameters
destination (str) –
Notes
When called the file_path changes to the given destination.
- await save(local_pathway: str) None ¶
Saves file to local pathway.
- Parameters
local_pathway (str) – Pathway to save file to.
- await unzip(destination: str) None ¶
Used to unzip a file.
- Parameters
destination (str) –
- await upload(data: Optional[bytes] = None) None ¶
Used for uploading raw bytes.
- Parameters
data (bytes) – Data to upload.
- await upload_file(local_pathway: str) None ¶
Used to upload a local file.
- Parameters
local_pathway (str) – Local file to upload.
Blocking¶
- class dathost.Blocking¶
- account() dathost.models.account.AccountModel ¶
Gets account details
- Returns
Holds data on a account.
- Return type
- close() None ¶
Closes sessions
- create_server(settings: dathost.settings.ServerSettings) Tuple[dathost.models.server.ServerModel, dathost.server.blocking.ServerBlocking] ¶
Creates a new server.
- Parameters
settings (ServerSettings) – Used to configure server.
- Returns
ServerModel – Holds data on server.
ServerBlocking – Used to interact with the created server.
- for ... in domains() Generator[str, None, None] ¶
Used to list domains.
- Returns
List of domains.
- Return type
list
- match(match_id: str) dathost.match.blocking.BlockingMatch ¶
Used to interact with a match.
- Parameters
match_id (str) – Dathost Match ID.
- Returns
- Return type
- server(server_id: str) dathost.server.blocking.ServerBlocking ¶
Used for interacting with a server.
- Parameters
server_id (str) – Datahost server ID.
- Returns
Used to interact with the server.
- Return type
- for ... in servers() Generator[Tuple[dathost.models.server.ServerModel, dathost.server.blocking.ServerBlocking], None, None] ¶
Used to list servers.
- Yields
ServerModel – Holds data on server.
ServerBlocking – Used to interact with server.
Server¶
- class dathost.server.blocking.ServerBlocking¶
- backup(backup_name: str) dathost.server.blocking.backup.BlockingBackup ¶
Used to interact with a backup.
- Parameters
backup_name (str) – Name of backup.
- Returns
- Return type
- for ... in backups() Generator[Tuple[dathost.models.backup.BackupModel, dathost.server.blocking.backup.BlockingBackup], None, None] ¶
Used to list backups a server has.
- Yields
BackupModel – Holds details on backup.
Backup – Used for interacting with a backup.
- console_retrive(lines: int = 1000) list ¶
Used to retrive lines from the console.
- Parameters
lines (int, optional) – Amount of lines to retrive, by default 1000
- Returns
List of strings.
- Return type
list
- Raises
InvalidConsoleLine – Raised when console lines below 1 or above 100000.
- console_send(line: str) None ¶
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] ¶
Creates a match.
- Parameters
match_settings (MatchSettings) – Holds details on the match.
- Returns
MatchModel – Holds match details.
BlockingMatch – Used to interact with a match.
- delete() None ¶
Used to delete a sever.
- duplicate(sync: bool = False) Tuple[dathost.models.server.ServerModel, dathost.server.blocking.ServerBlocking] ¶
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 ¶
Used to interact with a file on the server.
- Parameters
pathway (str) – Pathway of file on server.
- Returns
- Return type
- for ... in 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] ¶
Used to list files.
- Parameters
hide_default (bool, optional) – by default False
path (str, optional) – Path to use as root, by default None
file_sizes (bool, optional) – by default False
deleted_files (bool, optional) – Include deleted files in list, by default False
- Yields
FileModel – Holds details on a file.
BlockingFile – 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
- metrics() dathost.models.metrics.MetricsModel ¶
Used to get server metrics.
- Returns
Holds details on server metrics.
- Return type
- reset() None ¶
Used to reset the server.
- start(allow_host_reassignment: bool = True) None ¶
Used to stop the server.
- Parameters
allow_host_reassignment (bool, optional) – 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 (ServerSettings) – Used to configure server.
Match¶
- class dathost.match.blocking.BlockingMatch¶
- get() dathost.models.match.MatchModel ¶
Gets details on a match
- Returns
Holds match details.
- Return type
Backup¶
File¶
- class dathost.server.blocking.file.BlockingFile¶
- delete() None ¶
Deletes file.
- dowload() bytes ¶
Used to download a file into memory.
- Returns
- Return type
bytes
Notes
Its reccomened to use download_iterate for large files.
- download_iterate() None ¶
- Raises
AwaitingOnly – This function is meant only for awaiting code.
- move(destination: str) None ¶
Used for moving a file.
- Parameters
destination (str) –
Notes
When called the file_path changes to the given destination.
- save(local_pathway: str) None ¶
Saves file to local pathway.
- Parameters
local_pathway (str) – Pathway to save file to.
- unzip(destination: str) None ¶
Used to unzip a file.
- Parameters
destination (str) –
- upload(data: bytes) None ¶
Used for uploading raw bytes.
- Parameters
data (bytes) – Data to upload.
- upload_file(local_pathway: str) None ¶
Used to upload a local file.
- Parameters
local_pathway (str) – Local file to upload.