Client

class vshieldpy.Client(auth_key: str | None = None, **kwargs)

Asynchronous client for sending requests to the vShield API.

The naming convention for methods is similiar to a discord.py Client. Function names starting with fetch, send async requests and function names starting with get perform cache lookups. Any extra keyword arguments are passed to an httpx AsyncClient.

property auth_key: str

Currently set authentication key.

async change_server_ip(server_id: int) Payment

Change the server’s IP.

Raises:

InvalidServerID – An invalid server ID was provided.

Returns:

Only contains the price, and new_balance.

Return type:

Payment

async create_server_task(server_id: int, task: ServerActions, os: OperatingSystems | None = None) int

Starts a task execution for corresponding server for the ID.

Parameters:
  • server_id – Server ID for the server to start the ask on.

  • task – Task to be run on the server.

  • os – Choice of operating system. Required if the task to be performed is a reinstall.

Raises:
Returns:

The task ID for the task that was created.

Return type:

int

async create_service_task(service_id: int, task: ServiceActions, os: OperatingSystems | None = None) bool

Create a task on a dedicated server.

Should not be used on hosting plans.

Parameters:
  • service_id (int) – Service ID of the service to perform the task on.

  • task (ServiceActions) – Task to be performed on the service.

  • os (Optional[OperatingSystems], optional) – Should only be provided if the task is a reinstall. Defaults to None.

Raises:
Returns:

If the task was created successfuly returns True.

Return type:

bool

async delete_server(server_id: int) int

Deletes the server with the specified server_id.

There is no way to reverse this. This should be called with caution.

Parameters:

server_id – Server ID for the corresponding server.

Raises:

InvalidServerID – An invalid server ID was provided.

Returns:

The task ID for the server deletion task.

Return type:

int

async fetch_balance() float

Fetch the accounts current balance.

async fetch_firewall(service_id: int) Firewall

Fetch a specific firewall.

Parameters:

service_id – Service ID of the firewall.

Returns:

Firewall object containing recent attacks, subdomains and etc.

Return type:

Firewall

async fetch_invoice(invoice_id: int) Invoice

Fetch a specific invoice.

Parameters:

invoice_id – Invoice ID to fetch information from.

Returns:

Invoice object containing invoice information.

Return type:

Invoice

async fetch_invoices() tuple[Invoice, ...]

Fetch list of invoices.

async fetch_pending_orders() list[PendingServer]

Fetch currently pending orders.

Returns:

List of servers that are currently pending deployment.

Return type:

list[PendingServer]

async fetch_plans() StockStatus

Fetch available plans with their stock status.

Returns:

Current stock status of all plans.

Return type:

StockStatus

async fetch_server(server_id: int) Server

Fetch a single server.

Returned Server will have password information.

Parameters:

server_id – Server ID of the Server to lookup information.

Raises:

InvalidServerID – An invalid server ID was provided.

Returns:

Server object containing full information on a server. Including password information.

Return type:

Server

async fetch_server_console(server_id: int) str

Fetch url for console connection.

Parameters:

server_id – Server ID of the server to get a console connection URL for.

Raises:

InvalidServerID – An invalid server ID was provided.

Returns:

URL for the console session.

Return type:

str

async fetch_server_stats(server_id: int) ServerStats

Fetch server stats.

Parameters:

server_id – Server ID of the server to get the statistics for.

Raises:

InvalidServerID – An invalid server ID was provided.

Returns:

Contains stats for the server.

Return type:

ServerStats

async fetch_servers() Servers

Fetch all servers.

Servers returned will not have password information.

Returns:

All of the servers found. Servers returned will not contain a password.

Return type:

Servers

async fetch_service(service_id: int) Hosting | DedicatedServer

Fetch a single service.

Raises:

InvalidServiceID – An invalid service ID was provided.

async fetch_services() Services

Fetchs all currently active services.

Returns:

All currently active services.

Return type:

tuple[DedicatedServer | Hosting, …]

async fetch_task_info(task_id: int) Task

Fetch task information.

Raises:

InvalidTaskID – If the task ID provided was not valid.

Returns:

Task with the ID that was provided.

Return type:

Task

async fetch_transactions() tuple[Transaction, ...]

Fetch list of transactions.

async order_server(plan: Plans, location: Locations, hostname: str, os: OperatingSystems, days: int) Payment

Place an order for a new server.

The server can be retrieved via fetch_servers(), fetch_server() or fetch_pending_orders() if the order is pending.

Parameters:
  • plan – The plan to be ordered.

  • location – The location of the order. Valid locations of a plan can be retreived via StockStatus.

  • hostname – The hostname of the new server. Symbols are not allowed in the provided string.

  • os – Operating system to be installed on the server. If a reinstall is to be performed, an operating system from OperatingSystems must be provided.

  • days – Value must not be less than 1 or more than 365.

Raises:
  • InvalidHostname – An invalid hostname was provided.

  • InvalidDays – An invalid day count was provided.

  • ReinstallWithoutOS – A reinstallation task was started without providing OperatingSystems

  • InvalidParameter – Order parameters are incompatible. In particular means that the client side couldnt find any issues, and the API responded with no information. Often raised if a Plans is not sold in the provided location argument.

Returns:

Contains the transaction price, new balance, and the ID for the generated invoice.

Return type:

Payment

async renew_server(server_id: int, days: int) Payment

Renew the server.

Parameters:
  • server_id – Server ID for the corresponding server.

  • days – Value must not be less than 1 and more than 365.

Returns:

Contains the transaction price, new balance, and the new expiration date of the server.

Return type:

Payment

async renew_service(service_id: int, months: Literal[1, 3, 6]) Payment

Renew a specific service.

Parameters:
  • service_id (int) – Service ID of the service to perform the task on.

  • months (Literal[1, 3, 6]) – Number of months to renew the server.

Raises:
Returns:

The payment information returned by the API.

Return type:

Payment

async set_server_auto_renew(server_id: int, auto_renew: AutoRenew) AutoRenew

Set the server’s auto-renew status.

Parameters:
  • server_id – Server ID of the server to set the auto-renew status to.

  • auto_renew – The new auto-renew status.

Raises:

InvalidServerID – An invalid server ID was provided.

Returns:

The new auto-renew status.

Return type:

AutoRenew

async set_server_hostname(server_id: int, hostname: str)

Set the server’s new hostname.

Raises:
async set_service_auto_renew(service_id: int, auto_renew: AutoRenew) AutoRenew

Set the new auto-renew status for a service.

Parameters:
  • service_id – Service ID of the service to perform the task on.

  • auto_renew – An auto-renew status. Providing True enables auto-renewal.

Raises:

InvalidServiceID – An invalid service ID was provided.

Returns:

The new auto-renew status.

Return type:

AutoRenew

async upgrade_server(server_id: int, upgrade: Plans) Payment

Upgrade the server to a higher tier.

Provided upgrade plan must be in the same class and a higher tier than what the servers current plan is.

Raises:
  • InvalidServerID – An invalid server ID was provided.

  • InvalidParameter – A lower tier plan was provided than the server’s current plan, or attempted to upgrade across different plans. Such as a upgrading a VDS-PRO to a VPS.

Returns:

Only contains the price, and the new balance.

Return type:

Payment