Skip to content

Function Documentation

suspectedesp edited this page Apr 8, 2025 · 3 revisions

Bot Hosting Wrapper - Function Documentation

This wiki page provides an overview of all functions available in the bot-hosting-wrapper module. NOTE: This wiki page was automatically created by a module called pydoc-markdown

Installation

pip install bot-hosting-wrapper

about

Account Objects

class Account()

__init__

def __init__(auth_id)

Initializes an Account object with the given auth id. Args: auth_id (str): The auth id of the account.

coins_amount

def coins_amount() -> (Any | dict[str, str] | str)

Gets the total amount of your coins. Returns: The coin amount or a dictionary with an error message and status code if the request failed. {Error, Message}

affiliate_data

def affiliate_data() -> (dict[str, Any] | str)

Returns affiliate data (coins/referral, uses and your link) Returns: If status code is 200 and no error occurs:

about

def about()

Will give you a quick overview of your account. Returns a dictionary with account details or an 'error' message if something goes wrong.

id_check

def id_check(about=False)

Checks if your Auth ID is valid. Params: about (bool): If True, print user info in the console. Default is False.

sftp_pass

def sftp_pass()

This will generate a new SFTP password

claimable

def claimable()

Check if free coins are claimable and the time left

Server Objects

class Server()

change_language

def change_language(language=None, server_id: str = None)

Changes the programming language of a specified server.

Params: language (str, required): The programming language to switch to (java, python, nodejs, lua, deno, nodemon). server_id (str, required): The server ID.

Returns: dict: Success or error message.

get_info

def get_info(specific_info=None,
             everything=False,
             selected_server_id: str = None) -> dict | str

Fetches details about a selected server. Params: specific_info (str, optional): The specific info to retrieve (e.g., "cpu", "ram"). everything (bool, optional): Whether to return all server info. selected_server_id (str, optional): The server ID to query.

Returns: dict or str: A dictionary with server info if everything=True, or a specific info string. Returns a dictionary with an error message in case of failure.

show

def show()

Shows all your servers

delete

def delete(server_id=None)

This function gets all your server ids and on your request deletes a certain one (only with your confirmation) If server_id is provided, deletes that server directly; otherwise, prompts user for server selection.

interactive

Interactive Objects

class Interactive()

__init__

def __init__(auth_id)

Initializes the interactive Class Args: auth_id (str): The auth id of the account.

get_info

def get_info() -> None

First gets all your servers, then you can select a certain one, and it shows you the specific info about it Such as: Renewal, Identifier, Server ID, if its suspended, etc.

panel

Panel Objects

class Panel()

__init__

def __init__(api_key, server_id=None)

Initialize Panel class. Args: api_key (str): Bot-Hosting.net API key (https://control.bot-hosting.net/account/api) server_id (str): Optional, server ID for which to retrieve resources. Defaults to None.

get_2fa_code

def get_2fa_code()

Generates a TOTP QR code image to allow the setup of 2FA

enable_2fa

def enable_2fa(totp_code)

Enables TOTP 2FA by sending a POST request to the provided URL.

Args: totp_code (str): The Time-based One-Time Password (TOTP) generated from GET /account/two-factor or the get_2fa_code function.

Returns: dict or str: The JSON response if successful, or an error message with the status code and content.

disable_2fa

def disable_2fa(password)

Enables TOTP 2FA by sending a POST request to the provided URL.

Args: password (str): Existing Password | there is no info on how to get it lol

Returns: bool or dict: true if successful, or an error message with the status code and content.

Info: There is currently no way to obtain the password from the panel.

get_server_resources

def get_server_resources(server_id)

Retrieves the current resource usage of a specified server.

Parameters: server_id (str): The unique identifier of the server. If not provided, the server_id attribute of the Panel instance will be used.

Returns: dict: A dictionary containing the formatted resource usage information. If an error occurs, it returns a dictionary with an "Error" key set to True.

The returned dictionary has the following structure: { "Memory MB": "Memory usage GB", "Memory GB": "Memory usage in MB", "Network Inbound": "Inbound network traffic in MB", "Network Outbound": "Outbound network traffic in MB", "Disk Usage MB": "Disk usage in MB", "Disk GB": "Disk usage in GB" } Every value inside of the dictionary is currently a string

__init__

get_auth_id

@staticmethod
def get_auth_id() -> None

Prints a quick instruction on how to get the auth id Returns: None

Clone this wiki locally