pypleski Package Docs
pypleski.aps
The aps endpoint is no longer supported in Plesk Obsidian and later. Since pypleski does currently support Plesk Obsidian only this is not considered supported. We may implement older Packet Versions in future versions of pypleski.
Warning: This is only a template and their is no functionality in this Module.
Notes
- Not yet Supported:
DOWNLOAD-PACKAGE downloads an application package from the APS Catalog
GET-DOWNLOAD-STATUS retrieves the status of a package download task
IMPORT-PACKAGE imports to Plesk an application package uploaded to the server
GET-PACKAGES-LIST retrieves information on application packages available for installation on subscription’s main domain or subdomains
INSTALL installs an application on a subscription’s main domain or subdomains
IMPORT-CONFIG imports a custom list (configuration file) of APS Catalogs to Plesk
SET-PACKAGE-PROPERTIES displays or hides the package from customers and resellers when they view Applications Catalog
GET-PACKAGES-LIST-BY-RESELLER retrieves information on application packages installed on a reseller account
GET-PACKAGES-LIST-BY-WEBSPACE retrieves information on application packages installed under a subscription
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-aps-catalog-and-applications.64489/
pypleski.certificate
This module does nothing yet.
Warning: This is only a template and their is no functionality in this Module.
pypleski.core
The Core Module contains the Base Classes for all Modules and Plesk Packets as well as the API Client Classes.
Notes
- Changes 0.0.7:
PyPleskiApiClient was merged with PleskApiClient
Added some basic logging to PleskApiClient
Examples:
from pypleski.core import PleskApiClient, PleskRequestPacket
# Setup the PleskApiClient
client = PleskApiClient('localhost')
client.set_credentials("alvin","super_secret_password")
# Prepare a Request Packet with PleskRequestPacket
request = PleskRequestPacket(
"server",
"create_session",
login='alvin',
data={
'user_ip':127.0.0.1,
'source_server':'',
})
# Make the Request and retrive it as PleskResponsPacket
response = api.request(request)
# Print out your access token
print(response.to_dict()['packet']['server']['create_session']['result']['id'])
# You will not have to write as much when you use the other fun modules in this package.
from pypleski.core import PleskApiClient
from pypleski.server import get_session_token
# Setup the PleskApiClient
client = PleskApiClient('localhost')
client.set_credentials("alvin","super_secret_password")
# Make the Request and retrieve it as PleskResponsPacket
response = client.request(get_session_token("alvin", '127.0.0.1'))
print(response.to_dict()['packet']['server']['create_session']['result']['id'])
- class pypleski.core.PleskApiClient(server: str, port: int = 8443, use_ssl: bool = True, unverified_ssl: bool = False)
PleskApiClient(server:str, port:int=8443, use_ssl:bool = True, unverified_ssl:bool = False)
A simple http(s) client that uses http.client and ssl
- Parameters
server (_type_) – The URL to your PLESK Server
port (int, optional) – The Port PLESK is listening. Defaults to 8443.
use_ssl (str, optional) – Use SSL (https). Defaults to True.
unverified_ssl (bool, optional) – Ignore ssl errors. Defaults to False.
- set_credentials()
Set the username and Password to use.
- set_server()
Set the Plesk Server URL.
- set_access_token()
Set the Access token to use instead of credentials.
- set_use_ssl()
Set to True for secure connection.
- set_allow_unverified_ssl()
Set to True to allow unverfied ssl context.
- request(request
PleskRequestPacket or str,legacy:bool=False): Returns a PleskResponsePacket
- request(request: PleskRequestPacket) PleskResponsePacket
Send a Request to the set PLESK Server :param request: The Request to the PLESK API as PleskRequestPacket Object :type request: PleskRequestPacket
- Returns
The Response Packet as PleskResponsePacket Object
- Return type
- request_from_string(request: str) str
Send a Request to the set PLESK Server :param request: The Request to the PLESK API as XML String. :type request: str
- Returns
The Response as XML string
- Return type
str
- set_access_token(token: str) None
Set an access token to use instead of your credentials
- Parameters
token (str) – Your PLESK access token
- set_allow_unverified_ssl(unverified_ssl: bool) None
Set if unverified ssl context is allowed.
- Parameters
unverified_ssl (bool) – True turns ON | False turns OFF
- set_credentials(user: str, pswd: str) None
Set the credentials for PLESK
- Parameters
user (str) – Your PLESK username
pswd (str) – Your PLESK password
- set_port(port: int) None
Sets the port your Plesk is listening. Default is 8443.
- Parameters
port (int) – The port your Plesk is listening
- set_server(url: str) None
Sets the Plesk server base URL
- Parameters
url (str) – The URL to your Plesk Instance
- set_use_ssl(use_ssl: bool) None
Turn SSL on (True) or off (False). You want to use SSL.
- Parameters
use_ssl (bool) – True turns SSL on | False turns ssl off
- class pypleski.core.PleskApiClientDummy(server: str, port: int = 8443, use_ssl: bool = True, unverified_ssl: bool = False)
This class acts as placeholder for testing
- request(request: PleskRequestPacket, error: bool = False, **data) str
simulates a request and returns a positive add user operation or an webspace error
- Parameters
request (any) – the Request XML When using the dummy this does nothing.
error (bool, optional) – If you need an error set to True. Defaults to False.
- Returns
An XML Response String
- Return type
str
- class pypleski.core.PleskRequestPacket(module: str = 'webspace', operation: str = 'get', **data)
PleskRequestPacket(module:str =”webspace”, operation:str = “get”, **data)
Used to craft PLESK XML API requests
- Parameters
module (str, optional) – _description_. Defaults to “webspace”.
operation (str, optional) – _description_. Defaults to “get”.
**data – further keyword arguments
- Keyword Arguments
filter (dict) – Example: filter = {‘id’:23}
version (str) – Example: version = “1.6.9.1”
__data__ (dict) – Example __data__ = {‘id’:23,’subscription-id’:2}
selected (further keywords are available depending on the module and operation) –
Tipp: Use the new __data__ keyword to provide a prepared dict the __data__ keyword must be provided with an dict and will replace the **data (kwargs) dict after the filter keyword was processed
- add_data_to_node(parent, **data) None
Adds all data sets to the given parent Element
- Parameters
parent (xml.etree.ElementTree.Element) – The parent node to which you want to add **data.
**data (Any) – Keywords or Dictionary containing more keywords
- set_packet_version(version: str = '1.6.7.0') None
Sets the packet version for the request
- Parameters
version (str, optional) – Defaults to “1.6.7.0”.
- to_string(encoding='unicode') str
to_string function - returns the packet XML as a string :param encoding: Set string encoding - defaults to: UTF-8 :type encoding: string
- Returns
The Plesk Response XML as string
- Return type
str
- class pypleski.core.PleskResponsePacket(response_xml: str)
PleskResponsePacket(response_xml)
Stores Response Packets and converts them into different formats
- Parameters
response_xml (string) – Takes the response string from PleskClient.request()
- to_dict()
Returns the Response as a dictionary
- to_JSON()
Returns the Response as JSON formatted string
- to_list()
Returns the Response as a list
- to_string()
Returns the Response as XML string
- as_xml_etree_element()
Returns the Response as XML tree element
- is_error()
Returns True if the ResponsePacket contains an Error Response
- as_xml_etree_element() Element
- Returns
The response as xml.etree.ElementTree.Element object
- Return type
xml.etree.ElementTree.Element
- get_errcode() list
- Returns
Returns a list of errcodes found in the response. Empty list if no errcode was found.
- Return type
list(int)
- is_error() bool
- Returns
True if response contains an error
- Return type
bool
- to_JSON() str
- Returns
Response as JSON string
- Return type
str
- to_dict() dict
- Returns
Response as dict
- Return type
dict
- to_list() list
- Returns
Response as string list
- Return type
list
- to_string() str
- Returns
Response as XML string
- Return type
str
- pypleski.core.PyPleskiApiClient
alias of
PleskApiClient
pypleski.customer
This module’s functions, generate PleskRequestPackets using the ‘customer’ Operator.
Examples
Import the module to play with it:
>>> from pypleski.customer import as customer
Or import only the functions you want really want to use:
from pypleski.customer import get_customer_by_login, delete_customer_by_login, add_customer
# To craft a PleskRequestPacket simply call the function for the appropriate packet generator
# and save the output to a variable for further.
# Create a Package to request the creation of a new customer and print the package.
create_alvin = add_customer(cname="ACME Corp.", pname="Alvin", login="alvin@acme.corp"))
print(get_alvin)
# Create a Package to request Alvins information and print the request XML.
get_alvin = get_customer_by_login('alvin@acme.corp')
print(get_alvin)
# Create a Package to delete Alvin from Plesk.
delete_alvin = delete_customer_by_login('alvin@acme.corp')
print(delete_alvin)
Notes
- Currently Supported API Operations:
ADD creates new customer account to Plesk database.
GET retrieves the list of customer accounts from Plesk database.
DEL deletes the specified customer accounts from Plesk database.
SET updates/ modifies certain information about the specified customer accounts in Plesk database.
CONVERT-TO-RESELLER upgrades customer accounts to reseller accounts.
CHANGE-OWNER transfers customer accounts to a new owner (provider).
GET-DOMAIN-LIST retrieves information about all the customer’s domains.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-customer-accounts.28788/
- pypleski.customer.add_customer(**data) PleskRequestPacket
This Packet adds a new customer to plesk.
- Keyword Arguments
cname (str, optional) – Company Name
pname (str, optional) – Person Name
login (str) – Login Name
passwd (str) – Password
status (int, optional) – The Status of the Account in Plesk
phone (str, optional) – Phone Number
fax (str, optional) – Fax Number
email (str, optional) – e-Mail Address
address (str, optional) – Address
city (str, optional) – Address City
state (str, optional) – Address State
pcode (str, optional) – Address Post Code
country (str, optional) – Address Country
external_id (int, optional) – Customers External Identifier
description (str, optional) – Additional Description in Plesk
- Returns
The RequestPacket ready for use.
- Return type
Example
>>> # Create a new Customer with name Garry, login name garry1 and the Password T0pS3crt.P4$$w0Rd. >>> request = add_customer(pname="Garry", login = "garry1", passwd = "T0pS3crt.P4$$w0Rd" )
- pypleski.customer.change_owner(filter_name: str, filter_value: str, new_owners_login: str, ip: str = '', ip_addresses: Optional[List[str]] = None, plan: str = '') PleskRequestPacket
This Packet changes the owner of a customer. Currently only one ip address supported.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
new_owners_login (str) – The login name of the future owner.
ip (str, optional) – The ip that should be assigned to the customer.
ip_addresses (List[str], optional) – The List of IP addresses to assigned to the customer from the IP pool of the new owner.
plan – The name of the new plan defined by the new owner.
- Returns
The Plesk Request Packet ready to use.
- Return type
Notes
- Available Filter:
id: The customer’s ID.
login: The customers Login Name.
guid: The customers GUID.
external-id: The customers external identifier.
- Changes:
You can now set more then one IP address with one packet.
Example
>>> # Change the ownership of the user carl@acme.corp to faceless.manager@acme.corp >>> # and assign the IP addresses 10.10.10.2 and 11.10.10.5 >>> request = change_owner( >>> 'login', >>> 'carl@acme.corp', >>> 'faceless.manager@acme.corp, >>> ip_addresses=['10.10.10.2','11.10.10.5'] >>> )
- pypleski.customer.convert_to_reseller(filter_name: str, filter_value: str) PleskRequestPacket
This Packet converts the selected customer’s account to a reseller account in Plesk
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (any) – The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The customer’s ID.
login: The customers Login Name.
guid: The customers GUID.
external-id: The customers external identifier.
Example
>>> # Convert the customer with login carl@acme.corp >>> # into a reseller account >>> request = convert_to_reseller('login', 'carl@acme.corp')
- pypleski.customer.delete_all_customers() PleskRequestPacket
This Packet deletes customer accounts available to the Sender.
- Returns
The RequestPacket ready for use.
- Return type
Notes
This function only exists to avoid accidental deletion of all customers with the delete_customer() function. If you are absolutely sure you want to do this, use this function instead.
Example
>>> # Create a Packet with the request to delete ALL customer accounts >>> # available to the Sender. >>> request = delete_all_customers()
- pypleski.customer.delete_customer(filter_name: str, filter_value: str) PleskRequestPacket
This Packet deletes the specified customer.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- *Available Filter:
id: The customer’s ID.
login: The customers Login Name.
guid: The customers GUID.
external-id: The customers external identifier.
If you want to delete all accounts, use the delete_all_customers() function.
Example
>>> Create a Packet with the request to delete the customer with the id 12. >>> request = delete_customer('id', 12)
- pypleski.customer.delete_customer_by_guid(guid: str) PleskRequestPacket
This Packet deletes the customer with the specified GUID. :param guid: The users GUID in Plesk. :type guid: str
- Returns
The RequestPacket ready for use.
- Return type
Example
>>> # Delete the customer with the GUID f35187a8-8edf-11ed-a1eb-0242ac120002 >>> request = delete_customer_by_guid('f35187a8-8edf-11ed-a1eb-0242ac120002')
- pypleski.customer.delete_customer_by_id(user_id: int) PleskRequestPacket
This Packet deletes the customer with the specified id. :param user_id: the users :type user_id: int
- Returns
The RequestPacket ready for use.
- Return type
Example
>>> # Create a Packet with the request to delete the customer with the id 12. >>> request = delete_customer_by_id(12)
- pypleski.customer.delete_customer_by_login(login: str) PleskRequestPacket
This Packet deletes the customer with the specified login name. :param login: the users login name :type login: str
- Returns
The RequestPacket ready for use.
- Return type
Example
>>> # Create a Packet with the request to delete the customer >>> # with the login name 'alvin@acme.corp'. >>> request = delete_customer_by_login('alvin@acme.corp')
- pypleski.customer.get_customer_by_id(user_id: int, datasets: Optional[List[str]] = None) PleskRequestPacket
This Packet retrieves the specified dataset for the specified customer’s id.
- Parameters
user_id (int) – The customer’s id.
datasets (List[str]) – The dataset node. Defaults to None.
- Returns
The Plesk Request Packet ready to use.
- Return type
Notes
- Available Datasets:
gen_info: General Information
stat: Statistics
Examples:
>>> # Create a Request Package that requests only general information for the user with id 12 >>> request = get_customer_by_id(12)
>>> # Create a Request Packege that reqests only the statistics for the user with the id 12. >>> request = get_customer_by_id(12,['stat'])
>>> # Create a Request Packege that reqests the statistics and general information for the user with the id 12. >>> request = get_customer_by_id(12,['gen_info', 'stat'])
- pypleski.customer.get_customer_by_login(login: str, datasets: Optional[List[str]] = None) PleskRequestPacket
This Packet retrieves the specified dataset for the specified login name.
- Parameters
login (str) – The customers login name.
dataset (str) – The dataset node. Valid values: “gen_info”, “stat”. Defaults to “gen_info”.
- Returns
The Plesk Request Packet ready to use.
- Return type
Notes
- Available Datasets:
gen_info: General Information
stat: Statistics
Examples
>>> # Get general info about carl@acme.corp >>> request = get_customer_by_login('alvin@acme.corp')
>>> # Get the statistics for alvin@acme.corp >>> request = get_customer_by_login('alvin@acme.corp',['stat'])
- pypleski.customer.get_customer_info(filter_name: str = '', filter_value: str = '', datasets: Optional[List[str]] = None) PleskRequestPacket
This Packet gets information on the specified customer. If no Filter is used, all
- Parameters
filter_name (str, Optional) – The Filter used to select the customer.
filter_value (str, Optional) – The Value for the selected Filter.
datasets (List[str], Optional) – The datasets node. Defaults to None.
- Returns
The PleskRequestPacket ready to use.
- Return type
Notes
- Available Filter:
id: The customer’s ID.
login: The customers Login Name.
guid: The customers GUID.
external-id: The customers external identifier.
- Available Datasets:
gen_info: General Information
stat: Statistics
Examples
Without a Filter set, this packet will retrieve all available customer accounts available to the Sender. Not setting the datasets List will result into retrieving the gen_info dataset. >>> # This will return all customer with only their general information dataset >>> client.request(get_customer_info())
To get information on a specific user use a filter. >>> # This will return the customer with id 1 with only their general information dataset >>> client.request(get_customer_info(‘id’,’1’))
If you want to retrieve a specific or multiple datasets use the datasets keyword with a List. >>> # This will return all customers with only their statistics. >>> client.request(get_customer_info(datasets = [‘stat’]))
If you want to retrieve multiple datasets, make sure the order is correct.
>>> # This will return an error packet >>> client.request(get_customer_info(datasets = ['stat', 'gen_info'])) >>> # out: {"packet": {"@version": "1.6.7.0", "system": {"status": "error", "errcode": "1014", "errtext": "Parser error: Request is invalid. Error in line 1: Element 'gen_info': This element is not expected."}}}
>>> # This will return all customers with their general information and statistics. >>> client.request(get_customer_info(datasets = ['gen_info', 'stat']))
- pypleski.customer.get_customers(datasets: Optional[List[str]] = None) PleskRequestPacket
This Packet gets informatino about all customers available to the Sender.
- Parameters
datasets (List[str]) – The dataset node. Defaults to None.
- Returns
The Plesk Request Packet ready to use.
- Return type
Notes
If no Dataset is given, gen_info will be used by default.
- Available Datasets:
gen_info: General Information
stat: Statistics
Examples
>>> # Create a Request Package that requests only general information >>> # for all customers available to the Sender. >>> request = get_customers()
>>> # Create a Request Packege that reqests only the statistics >>> # for all customers available to the Sender. >>> request = get_customers(['stat'])
>>> # Create a Request Package that requests the statistics and general information >>> # for all customers available to the Sender. >>> request = get_customers(['gen_info', 'stat'])
- pypleski.customer.get_domain_list(filter_name: str, filter_value: str) PleskRequestPacket
This Packet gets the selected customer’s domain list.
Args: * filter_name (str): The Filter used to select the customer. * filter_value (any): The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The customer’s ID.
login: The customers Login Name.
guid: The customers GUID.
external-id: The customers external identifier.
Example
>>> # Get the domain list for the customer with login name carl@acme.corp. >>> request = get_domain_list('login', 'carl@acme.corp')
- pypleski.customer.set_customer_info(filter_name: str, filter_value: str, **data) PleskRequestPacket
This Packet changes the selected fields (keywords) for the specified customer
- Parameters
filter_name (str) – The Filter Name to select the customer.
filter_value (str) – The Filter Value.
- Keyword Arguments
cname (str) – Company Name
pname (str) – Person Name
login (str) – Login Name
passwd (str) – Password
status (int) – The Status of the Account in Plesk
phone (str) – Phone Number
fax (str) – Fax Number
email (str) – e-Mail Address
address (str) – Address
city (str) – Address City
state (str) – Address State
pcode (str) – Address Post Code
country (str) – Address Country
external_id (int) – Customers External Identifier
description (str) – Additional Description in Plesk
- Returns
The Plesk Request Packet ready to use.
- Return type
Notes
- *Available Filter:
id: The customer’s ID.
login: The customers Login Name.
guid: The customers GUID.
external-id: The customers external identifier.
Examples
>>> # Create a packet that request the change of the company name >>> # for the customer with id 12 to "ACME CORP.". >>> request = set_customer_info('id', 12, cname="ACME CORP.")
pypleski.database
This module’s functions, generate PleskRequestPackets using the ‘database’ Operator.
Examples
Import the module to play with it:
>>> from pypleski import database as db
Or import only the functions you want really want to use:
from pypleski.database import get_customer_by_login, delete_customer_by_login, add_customer
# To craft a PleskRequestPacket simply call the function for the appropriate packet generator
# and save the output to a variable.
# Add a new mysql database with name db3 for the domain with id 3
new_database = add_database(3,"db3", "mysql")
print(new_database)
# Create a Package to request Alvins information and print the request XML.
get_alvin = get_customer_by_login('alvin@acme.corp')
print(get_alvin)
# Create a Package to delete Alvin from Plesk.
delete_alvin = delete_customer_by_login('alvin@acme.corp')
print(delete_alvin)
Notes
- Supported API Calls
ADD-DB creates database entry of the specified type, defining the subscription that will use it.
DEL-DB removes database entry; If a database is used by an application installed on the server, it cannot be removed.
GET-DB retrieves database parameters by the ID, subscription name or subscription ID.
ASSIGN-TO-SUBSCRIPTION moves a database to another subscription.
SET-DEFAULT-USER specifies a default database user that Plesk uses for accessing the database.
GET-DEFAULT-USER retrieves ID of administrator of a specified database.
ADD-DB-USER creates a database user account for a specified database.
DEL-DB-USER removes a database user account from a specified database.
GET-DB-USERS retrieves the list of users of a specified database and information about access control records for MySQL databases.
SET-DB-USER changes credentials of a database user and specifies hosts or IP addresses from which database users are allowed to connect to
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-database-servers.35174/
- pypleski.database.add_database(webspace_id: int, database_name: str, database_type: str, db_server_id: int = 0) PleskRequestPacket
This Packet adds a new database to a webspace subscription
- Parameters
webspace_id (int) – The webspace subscription that will hold the new Database
database_name (str) – The name for your Database
database_type (str) – The type of Database you want to create
db_server_id (int, optional) – Only required for admin on unix. Defaults to None. Specifies the ID of the database server on which the database will be created. If the node is not used, the default database server of the corresponding type will be used for the database creation. Data type: integer.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available database types:
mysql
mssql
postgre
Example
>>> # Add a new mysql database with name db3 for the domain with id 3 >>> request = add_database(3, "db3", "mysql")
- pypleski.database.add_database_user(database_filter_name: str, database_filter_value: str, login_name: str, login_pwd: str, **data) PleskRequestPacket
You can create user accounts for a certain database or create universal users with access to all databases within a subscription:
- Parameters
database_filter_name (str) – The name of the filter to select a database. See Available Filters.
database_filter_value (any) – The value for the selected filter.
login_name (str) – The login name for the new user
login_pwd (str) – The login password for the new user
- Keyword Arguments
password_type (str) – Optional. Is the password plain or encrypted? Allowed values: “plain” | “crypt”. Defaults to “plain”
role (str) – Optional. Specifies the database user role. Data type: string. Allowed values: “readWrite”, “readOnly”, “writeOnly”.
acl (SPECIAL CASE) – Optional. Specifies the hosts from which a database user is allowed to connect to a database.
allow_access_from (SPECIAL CASE) – node is optional. It specifies the IP addresses from which access to a database is allowed. Data type:DatabaseUserRemoteAccessRulesType, which consists of ip-address elements of the string data type
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Availabe Filters:
db-id: Used to create a user with access to the specified database.
webspace-id: Used to create a universal user with access to all databases within the specified subscription.
db-server-id: Used to create a universal user with access to all databases within the specified database server.
- pypleski.database.assign_to_subscription(filter_name: str, filter_value: str, webspace_id: int) PleskRequestPacket
This packet will assign a database to another subscription.
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter
- Returns
The RequestPacket ready for use.
- Return type
Notes
- pypleski.database.delete_all_database_users() PleskRequestPacket
!WARNING! This packet will delete all users from all databases the sender has access to
- Returns
The Packet ready for use.
- Return type
PleskRequestPacket or None
- pypleski.database.delete_all_users_from_database(database_id: int) PleskRequestPacket
!!! This one does not make sense. !!! Supposedly, this packet deletes all users from the specified database
- Parameters
database_id (int) – The id of the database
!!! Something is off with the documentation on this one. The examples are confusing as they are probably supposed different.
So this needs testing and where possible confirmation by research. !!!
- Returns
PleskRequestPacket
- Return type
- pypleski.database.delete_database(database_id: int) PleskRequestPacket
This Packet deletes the specified database
- Parameters
database_id (int) – The id of the database to delete
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.database.delete_database_user(user_id: int) PleskRequestPacket
This packet deletes the specified database user
- Parameters
user_id (int) – The id of the user zou want to delete
!!! Something is off with the documentation on this one. The examples are confusing as they are probably supposed different.
So this needs testing and where possible confirmation by research. !!!
- Returns
PleskRequestPacket
- Return type
- pypleski.database.get_database(db_id: str) PleskRequestPacket
This Packet will get information about the specified database
- Parameters
db_id (int) – The id of the database.
- Returns
The RequestPacket ready for use.
- Return type
Example
>>> # Get information about the database with id 14 >>> request = get_database(14)
- pypleski.database.get_database_default_user(database_id: int) PleskRequestPacket
This Packet will get the default user for the specified database.
- Parameters
database_id (int) – The id of the database.
- Returns
The RequestPacket ready for use.
- Return type
Example
>>> # Get the default user for the database with id 76. >>> request = get_database_default_user(76)
- pypleski.database.get_database_users(database_id: int) PleskRequestPacket
This Packet retrieves information on users of the specified database
- Parameters
database_id (int) – The id of the database.
- Returns
The Packet ready to use.
- Return type
- pypleski.database.get_databases(filter_name: str, filter_value: str) PleskRequestPacket
This Packet will get informataion about the datbases within a subscription or for a single database with the id filter.
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: specifies the ID of a database. Data type for filter_value: int.
webspace-id: specifies the ID of the subscription. Data type for filter_value: int.
webspace-name: specifies the name of the subscription (domain). Data type for filter value: str.
Example
>>> # Get the databases associated with the domain acme.corp >>> request = get_databases('webspace-name', 'acme.corp')
- pypleski.database.set_database_default_user(database_id: int, user_id: int) PleskRequestPacket
set the default user for the database
- Parameters
database_id (int) – the id of the database
user_id (int) – the default admin user
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.database.set_database_user(user_id: int, **data) PleskRequestPacket
This Packet sets the data of the specified user
- Parameters
user_id (int) – The id of the user to modify.
**data (keywoards) – more keyword arguments
- Keyword Arguments
id (int) – specifies the ID of the database user whose preferences are to be changed. Data type: integer.
login (str) – specifies new login name for the database user. Data type: string.
password (str) – specifies new password for the database user. Data type: string (length should be more than five digits).
password_type (str) – specifies whether it is a plain or encrypted password. Data type:string. Allowed values: plain | crypt.
acl (! SPECIAL CASE) – acl = {‘host’:’127.0.0.1’}: specifies the hosts from which a database user is allowed to connect to a database. Data type:DatabaseUserAclType, which consists of host elements of the string data type.
allow_access_from (! SPECIAL CASE) – node is optional. It specifies the IP addresses from which access to a database is allowed. Data type:DatabaseUserRemoteAccessRulesType, which consists of ip-address elements of the string data type
type (role node is optional. It specifies the database user role. Data) – string. Allowed values: readWrite, readOnly, writeOnly.
- Returns
The Packet ready to use.
- Return type
pypleski.db_server
This module’s functions, generate PleskRequestPackets using the ‘db_server’ Operator.
Notes
- Supported API Operations:
ADD creates a database server entry of the specified type, specifying the login and password of the database administrator.
SET updates properties of the specified database server.
DEL removes a database server entry. Only remote database servers can be specified. The default database server cannot be removed.
SET-DEFAULT sets a remote database server entry as default for its DBMS type. Only remote database servers can be specified.
GET-DEFAULT retrieves ID of a default database server.
GET retrieves the database server info by the server ID.
GET-SUPPORTED-TYPES get the DBMS types supported by the Plesk.
GET-LOCAL retrieves ID of a local database server.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-database-servers.35174/
- pypleski.db_server.add_db_srv(host: str, port: int, admin: str, password: str = '', db_type: str = 'mysql') PleskRequestPacket
This Packet creates a database server entry of the specified type, specifying the login and password of the database administrator.
- Parameters
host (str) – IP address or name of the database server you want to add.
port (int) – port of the database server.
admin (str) – The admin login name for the server.
password (str, optional) – The admins password. Defaults to: None.
db_type (str) – database server type. Allowed values: mysql | postgresql | mssql. Defaults to: mysql.
- pypleski.db_server.delete_db_srv(id: int) PleskRequestPacket
This Packet removes a database server entry. Remote database servers only. Default database server cannot be removed.
- Parameters
id (int) – The ID of the database server to detach from plesk.
- Returns
_description_
- Return type
_type_
- pypleski.db_server.get_db_srv(srv_id: int) PleskRequestPacket
This Packet retrieves the database server info by the server ID.
- Parameters
srv_id (int) – The server id
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.db_server.get_default_srv(db_type: str = 'mysql') PleskRequestPacket
This Packet retrieves ID of a default database server.
- Parameters
db_type (str, optional) – The DBMS type. Defaults to ‘mysql’.
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.db_server.get_local(DBMS_type: str = '') PleskRequestPacket
This Packet retrieves ID of a local database server.
- Parameters
DBMS_type (str, optional) – The DBMS type. Leave empty to get all default database servers. Defaults to None. Allowed values: mysql | postgresql | mssql | None.
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.db_server.get_supported_types() PleskRequestPacket
This packet gets the DBMS types supported by the Plesk.
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.db_server.set_db_srv(srv_id: int, host: str, port: int, admin: str, password: str = '', db_type: str = 'mysql') PleskRequestPacket
This Packet updates properties of the specified database server.
- Parameters
srv_id (int) – The id of the server to update with the given settings
host (str) – IP address or name of the database server you want to add.
port (int) – port of the database server.
admin (str) – The admin login name for the server.
password (str, optional) – The admins password. Defaults to: None.
db_type (str) – database server type. Allowed values: mysql | postgresql | mssql. Defaults to: mysql.
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.db_server.set_default_srv(filter_name: str, filter_value: str) PleskRequestPacket
This Packet sets a remote database server entry as default for its DBMS type. Only remote database servers can be specified._summary_
- Parameters
filter_name (str) – _description_
filter_value (any) – _description_
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filters:
id (int): The id of the remote database server to be used as default server.
type (str): The type of local database server to be used as default. Allowed values: mysql | postgresql | mssql.
pypleski.dns
This module’s functions, generate PleskRequestPackets using the ‘dns’ Operator.
Notes
- Supported API Operations:
ADD_REC adds a DNS record of the specified type to the specified site zone
GET_REC retrieves information about certain DNS records
DEL_REC removes the specified DNS record(s)
GET_ACL retrieves access control lists (ACL) from the server
ADD_TO_ACL adds hosts to ACL
REMOVE_FROM_ACL removes hosts from ACL
SWITCH switches the DNS zone type between ‘master’ and ‘slave’
ADD_MASTER_SERVER adds a new master DNS server for the specified zone
GET_MASTER_SERVER retrieves the master server for the specified zone
DEL_MASTER_SERVER removes the master server for the specified zone
ENABLE enables the name server for the specified zone
DISABLE disables the name server for the specified site
ENABLE-REMOTE-DNS switches the DNS server to primary mode
DISABLE-REMOTE-DNS switches the DNS server to slave mode
GET-STATUS-REMOTE-DNS retrieves the status of the remote DNS server
SET-RECURSION sets up preferences of recursive requests to DNS server
GET-RECURSION retrieves the recursion preferences DNS server
GET-SUPPORTED-RECURSION retrieves the available types of recursion for the
- Not yet supported:
SET updates the SOA record settings for the specified zone or zone template
GET retrieves the SOA record settings
SYNC-WITH-TEMPLATE Linux gives you the ability to synchronize all the DNS records containing a predefined IP address with the server-wide DNS template.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-dns.34756/
- pypleski.dns.add_host_to_acl(host: str) PleskRequestPacket
This Packet adds a new host to the ACL of your name server. (Linux only) :param host: The IP of the host to add. :type host: str
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.add_primary(id_site: int, ip: str, site_as_alias: bool = False) PleskRequestPacket
This Packet add a primary name server to the given site
- Parameters
id_site (int) – the site-id or site-alias-id
ip (str) – _description_
site_as_alias (bool, optional) – Set to True to indicate the given id represents a site alias. Defaults to False.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.add_record(id_site: int, record_type: str, record_value: str, site_as_alias: bool = False) PleskRequestPacket
This Packet adds a DNS record of the specified type to the specified site zone.
- Parameters
id_site (int) – The site-id or site-alias-id.
record_type (str) – The type of DNS-Record to set. Allowed values: A | NS | CNAME | MX | PTR | TXT | SOA | AXFR | SRV | AAAA | DS.
record_value (str) – The value for the record.
site_as_alias (bool, optional) – Set to True to indicate the given id represents a site alias. Defaults to False.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.delete_primary(filter_name: str = '', filter_value: str = '') PleskRequestPacket
_summary_
- Parameters
filter_name (str, optional) – _description_. Defaults to None.
filter_value – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.delete_record(filter_name: str = '', filter_value=None, get_zone_template_entries=False) PleskRequestPacket
This Packet deletes the specified DNS records.
- Parameters
filter_name (str, optional) – _description_. Defaults to None.
filter_value (any, optional) – _description_. Defaults to None.
get_zone_templates_entries (bool, optional) – False.
- Returns
PleskRequestPacket
- Return type
Notes
- Available Filters:
site-id: The id of the site from which you wich to retrieve the records
id: The id of a specific record
- pypleski.dns.delete_record_by_id(record_id: int) PleskRequestPacket
Convenience function. This Packet deletes the specified DNS record.
- Parameters
record_id (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.delete_records_by_site_id(site_id: int) PleskRequestPacket
Convenience function. This Packet delets all DNS records for the specified site-id.
- Parameters
id_site (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.disable_local(filter_name: str = '', filter_value: str = '') PleskRequestPacket
This Packet disables local DNS support for the DNS zone template or the specified zone/site.
- Available Filter:
site-id: id: site-alias-id:
If a filter is not set, the DNS zone template will change status to “disable”.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.disable_remote_dns() PleskRequestPacket
This Packet used to disable the remote DNS server. (Windows 8.1+ only)
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.enable_local(filter_name: str = '', filter_value: str = '') PleskRequestPacket
This Packet enables local DNS support for the DNS zone template or the specified zone/site.
If a filter is not set, the DNS zone template will change status to “enable”.
- Available Filter:
site-id: id: site-alias-id:
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.enable_remote_dns() PleskRequestPacket
This Packet is used to enable the remote DNS server. (Windows 8.1+ only)
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_acl() PleskRequestPacket
This Packet retrieves the ACL of your name server. (Linux only)
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_primary(filter_name: str = '', filter_value: str = '') PleskRequestPacket
_summary_
- Parameters
filter_name (str, optional) – _description_. Defaults to None.
filter_value – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_record_by_id(record_id: int) PleskRequestPacket
Convenience function. This Packet gets the specified DNS record.
- Parameters
record_id (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_records(filter_name: str = '', filter_value=None, get_zone_template_entries=False) PleskRequestPacket
This Packet retrieves information about the specified DNS records.
- Parameters
filter_name (str, optional) – _description_. Defaults to None.
filter_value (any, optional) – _description_. Defaults to None.
get_zone_templates_entries (bool, optional) –
- Returns
PleskRequestPacket
- Return type
Notes
- Available Filters:
site-id: The id of the site from which you wich to retrieve the records
id: The id of a specific record
- pypleski.dns.get_records_by_site_id(site_id: int) PleskRequestPacket
Convenience function. This Packet gets all DNS records for the specified site-id.
- Parameters
id_site (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_recursion() PleskRequestPacket
This Packet is used to retrieve the set recursion type.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_remote_dns_status() PleskRequestPacket
This Packet used to retrieve the status of the remote DNS server. (Windows 8.1+ only)
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.get_supported_recursion() PleskRequestPacket
This Packet is used to retrieve the supported recursion types.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.remove_host_from_acl(host: str) PleskRequestPacket
This Packet adds a new host to the ACL of your name server. (Linux only) :param host: The IP of the host to add. :type host: str
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.set_recursion(recursion_type: str = 'on') PleskRequestPacket
This Packet sets the type of recursion. Before setting the recursion type, make sure it is supported by the server.
- Parameters
recursion_type (str) – Allowed values: on | off | local | localnets.
- Returns
PleskRequestPacket
- Return type
- pypleski.dns.switch_zone_type(site_id: int, z_type: str) PleskRequestPacket
This Packet switches the specified sites name server between master and slave mode.
- Parameters
site_id (int) – The site-id of the DNS Server.
zone_type (str) – Allowed values: master | slave.
- Returns
PleskRequestPacket
- Return type
pypleski.error_handling
pypleski.extension
This Module’s functions generate requests to talk to the Plesk Extension Endpoint.
Notes
- Supported API Calls:
INSTALL installs an extension from the specified URL.
CALL calls an XML API operation specific to a particular extension.
GET retrieves information on installed extensions.
UNINSTALL uninstalls an extension with the given ID.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-plesk-extensions.76730/
- pypleski.extension.call_to_extension(**call) PleskRequestPacket
This Packet sends the specified call to the extension. The Format of calls depend on the extension.
- Returns
PleskRequestPacket
- Return type
- pypleski.extension.get_extensions(extension_id: str = '') PleskRequestPacket
This Packet retrieves information on installed extensions. Gets all if extension_id is None
- Parameters
extension_id (str, oprional) – Id of the extension you may want to specifie
- Returns
PleskRequestPacket
- Return type
- pypleski.extension.install_extension(install_from_url: str = '', install_by_id: str = '') PleskRequestPacket
- This Packet installs a packet either from the given url or by id.
If both options are provided, install install_by_id will be used.
- Parameters
install_from_url (str, optional) – URL as source for installation. Defaults to None.
install_by_id (str, optional) – Id of the extension to install. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.extension.uninstall_extension(extension_id: str) PleskRequestPacket
This Packet unbinstalls the specified extension.
- Parameters
extension_id (str) – Id of the extension to uninstall.
- Returns
PleskRequestPacket
- Return type
pypleski.ftp_user
This module’s functions, generate PleskRequestPackets using the ‘ftp-user’ Operator.
Notes
- Supported API Operations:
DEL deletes FTP account from a specified site
GET retrieves information on properties of specified FTP accounts on particular sites
ADD creates FTP account on a site specified by its name or ID
SET changes properties of a specified FTP account
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-ftp-accounts.35213/
- pypleski.ftp_user.add_ftp_user(name: str, password: str, webspace: str, home: str = '', create_non_existent: bool = False, quota: int = 0, permissions: str = 'rw') PleskRequestPacket
This Packet creates a new FTP user for the specified webspace.
- Parameters
name (str, required) – the name under which the FTP account will be known in Plesk, and the account login.
password (str, required) – the FTP account password.
webspace – (str or int, required): The site name or webspace id where the user should be created.
home (str, optional) – the home directory of the account. Leave empty to use default directory. Defaults to: ‘’.
create-non-existent (bool, optional) – if the home directory should be created or not. This node with value true is required if the home directory defined by the home node does not exist on the site.
quota (int, optional) – the maximum total size of files and folders (in bytes) that the FTP account user can create in or upload to the home directory.
permissions (str, optional) – the FTP account permissions for home directory. Allowed values rw|r|w. Defaults to: rw.
Notes
Differences to documented XML API Calls
- webspace translates to either:
webspace-id (int, required): the ID of the site on which the FTP account is created.
- or:
webspace-name (str, required): the name of the site (in unicode) on which the FTP account is created.
permissions translates to up to 2 subnodes (read/ and write/)
- returns
PleskRequestPacket
- rtype
PleskRequestPacket
- pypleski.ftp_user.delete_ftp_user(filter_name: str, filter_value: str) PleskRequestPacket
This Packet delets the selected user or all users from the selected webspace.
- Parameters
filter_name (str) – _description_
filter_value (str) – _description_
- Returns
PleskRequestPacket
- Return type
Notes
- Available Filters:
id (int) : Specifies the FTP account ID in Plesk database.
name (str): Specifies the name of FTP account. Data type: string.
webspace-id (int): Specifies the unique identifier of the site on which the FTP account exists. Data type: integer.
webspace-name (str): Specifies the name of the site (in Unicode) on which the FTP account exists. Data type: string.
- pypleski.ftp_user.get_ftp_user(filter_name: str, filter_value: str) PleskRequestPacket
This Packet gets information on the selected user or all users from the selected webspace.
- Parameters
filter_name (str) – _description_
filter_value (any) – _description_
- Returns
PleskRequestPacket
- Return type
Notes
- Available Filters:
id (int) : Specifies the FTP account ID in Plesk database.
name (str): Specifies the name of FTP account. Data type: string.
webspace-id (int): Specifies the unique identifier of the site on which the FTP account exists. Data type: integer.
webspace-name (str): Specifies the name of the site (in Unicode) on which the FTP account exists. Data type: string.
- pypleski.ftp_user.set_ftp_user(filter_name: str, filter_value: str, name: str = '', password: str = '', home: str = '', create_non_existent=False, quota: int = 0, permissions: str = '') PleskRequestPacket
This Packet is used to change the selected users.
- Parameters
filter_name (str) – _description_
filter_value (str) – _description_
name (str, optional) – _description_. Defaults to None.
password (str, optional) – _description_. Defaults to None.
home (str, optional) – _description_. Defaults to ‘’.
create_non_existent (bool, optional) – _description_. Defaults to False.
quota (int, optional) – _description_. Defaults to None.
permissions (str, optional) – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
Notes
- Available Filters:
id (int) : Specifies the FTP account ID in Plesk database.
name (str): Specifies the name of FTP account. Data type: string.
webspace-id (int): Specifies the unique identifier of the site on which the FTP account exists. Data type: integer.
webspace-name (str): Specifies the name of the site (in Unicode) on which the FTP account exists. Data type: string.
pypleski.git
This module’s functions, generate PleskRequestPackets using the ‘extension’ Operator to make calls to the Git Extension.
Notes
This is not core functionality. Git is available as an extension.
- Supported Opreations:
GET retrieves information about the Git repositories on a domain or on all domains
CREATE adds new Git repository
UPDATE updates a Git repository settings
REMOVE removes a Git repository
DEPLOY deploys changes from a Git repository to a target directory
FETCH fetches the remote repository for a Git repository of the Using remote Git hosting type
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-git-repositories.75959/
- pypleski.git.create_git_repository(domain: str, name: str, deployment_path: str = '', deployment_mode: str = '', remote_url: str = '', skip_ssl: bool = False, actions: str = '') PleskRequestPacket
This Packet adds new Git repository
- Parameters
domain (str) – _description_
name (str) – _description_
deployment_path (str, optional) – _description_. Defaults to None.
deployment_mode (str, optional) – _description_. Allowed Values: auto | manual | none Defaults to None.
remote_url (str, optional) – _description_. Defaults to None.
skip_ssl (bool, optional) – _description_. Defaults to False. ( remote hosts only)
actions (str, optional) – actions are shell commands delimited by “;” symbol that should be used with an escape character: “>”. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.git.delete_git_repository(domain: str, name: str) PleskRequestPacket
This Packet delets the specified Git repository.
- Parameters
domain (str) – _description_
name (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.git.deploy_git_repository(domain: str, name: str)
This Packet deploys the Git repository to it’s defined deploy path.
- Parameters
domain (str) – _description_
name (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.git.fetch_git_repository(domain: str, name: str)
This Packet fetches the changes from a remote repository to a Git repository.
- Parameters
domain (str) – _description_
name (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.git.get_git_repositories(domain: str = '') PleskRequestPacket
This Packet retrieves information about the present Git Repositories.
- Parameters
domain (str, optional) – Only show results for this domain. Gets All if set to None. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.git.update_git_repository(domain: str, name: str, new_name: str = '', deployment_path: str = '', deployment_mode: str = '', remote_url: str = '', skip_ssl: bool = False, active_branch: str = '', actions: str = '') PleskRequestPacket
This Packet sets a Git repository’s settings.
- Parameters
domain (str) – _description_
name (str) – _description_
new_name (str, optional) – _description_. Defaults to None.
deployment_path (str, optional) – _description_. Defaults to None.
deployment_mode (str, optional) – _description_. Allowed Values: auto | manual | none Defaults to None.
remote_url (str, optional) – _description_. Defaults to None.
skip_ssl (bool, optional) – _description_. Defaults to False. ( remote url only)
active_branch (str, optional) – _description_. Defaults to None.
actions (str, optional) – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
pypleski.ip
This module’s functions, generate PleskRequestPackets using the ‘ip’ Operator.
Notes
- Supported API Operations:
ADD adds an IP address to Plesk server as shared or exclusive, specifying a netmask and server network interface
GET retrieves the list of IP addresses available on the server
SET updates properties for IP addresses available on the server
DEL removes an IP address from Plesk server
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-ip-addresses.35389/
- pypleski.ip.add_ip(ip_address: str, subnetmask: str, ip_type: str, interface: str, service_node=None, public_ip: str = '') PleskRequestPacket
This Packet adds an IP address to your Plesk server as shared or exclusive.
- Parameters
ip_address (str) – _description_
subnetmask (str) – _description_
ip_type (str) – Allowed values
interface (str) – _description_
service_node (dict, optional) – _description_. Defaults to None.
public_ip (str, optional) – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.ip.delete_ip(ip: str) PleskRequestPacket
This Packet removes the specified IP address from the server.
- Parameters
ip (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.ip.get_ips() PleskRequestPacket
This Packet retrieves the list of IP addresses available on the server.
- Returns
PleskRequestPacket
- Return type
- pypleski.ip.set_ip(ip: str, ip_type: str, cert_name: str = '', public_ip: str = '', service_node=None) PleskRequestPacket
This Packet updates properties for the specified IP address.
- Parameters
ip (str) – _description_
ip_type (str, optional) – _description_
cert_name (str, optional) – _description_
public_ip (str, optional) – _description_
service_node (dict, optional) – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
pypleski.locales
This Module’s Function use the “locale” Operator.
Notes
- Supported Operations:
GET retrieves info on the language packs installed on Plesk server
GET-MESSAGE retrieves the message specified by a key from resource files of the language pack
ENABLE enables the language pack on the server
DISABLE disables the language pack on the server
All Language Codes: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-locales/locale-codes.39382/ Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-locales.40658/
- pypleski.locales.disable_language_pack(locale_id: str) PleskRequestPacket
This Packet disables the language pack on the server.
- Parameters
locale_id (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.locales.enable_language_pack(locale_id: str) PleskRequestPacket
This Packet enables the language pack on the server.
- Parameters
locale_id (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.locales.get_installed_language_packs(locale_id: str = 'en-US') PleskRequestPacket
This Packet retrieves info on the language packs installed for the specified language.
- Parameters
local_id (str, optional) – _description_. Defaults to “en-US”.
- Returns
PleskRequestPacket
- Return type
- pypleski.locales.get_localized_message(key: str, locale_id: str = 'en-US') PleskRequestPacket
This Packet retrieves the message specified by a key from resource files of the language pack.
- Parameters
key (str) – _description_
local_id (str, optional) – _description_. Defaults to “en-US”.
- Returns
PleskRequestPacket
- Return type
pypleski.log_rotation
Notes
- Supported Operations:
GET retrieves Log Rotation settings.
ENABLE enables Log Rotation service on a site
DISABLE disables Log Rotation service on a site
GET-STATUS retrieves status of Log Rotation service
SET changes Log Rotation settings.
- Review:
Improve doc strings SET function is not very elegant.
- pypleski.log_rotation.disable_log_rotation(filter_name: str, filter_value: str) PleskRequestPacket
This Packet disables the log rotation service for the selected site or owner.
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter
- Returns
The RequestPacket ready to use.
- Return type
Notes
- Available Filters:
site-id (int)
owner-id (int)
site-name (str)
owner-login (str)
- pypleski.log_rotation.enable_log_rotation(filter_name: str, filter_value: str) PleskRequestPacket
This Packet enables the log rotation service for the selected site or owner
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter
- Returns
The RequestPacket ready to use.
- Return type
Notes
- Available Filters:
site-id (int)
owner-id (int)
site-name (str)
owner-login (str)
- pypleski.log_rotation.get_log_rotation_settings(filter_name: str, filter_value: str) PleskRequestPacket
This Packet retrieves settings of Log Rotation of sites by site or owner.
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter.
- Returns
The RequestPacket ready to use.
- Return type
Notes
- Available Filters:
site-id (int)
owner-id (int)
site-name (str)
owner-login (str)
- pypleski.log_rotation.get_log_rotation_status(filter_name: str, filter_value: str) PleskRequestPacket
This Packet retrieve status of Log Rotation service on sites by site or owner.
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter
- Returns
The RequestPacket ready to use.
- Return type
Notes
- Available Filters:
site-id (int)
owner-id (int)
site-name (str)
owner-login (str)
- pypleski.log_rotation.set_log_rotation_settings(filter_name: str, filter_value: str, log_by_size: int = 0, log_by_time: str = '', log_max_num_files: int = 0, log_compress: str = '', log_email: str = '') PleskRequestPacket
This Packet
- Parameters
filter_name (str) – The name of the filter. See available filters.
filter_value (any) – The value to use with the selected filter
log_by_size (int, optional) – _description_. Defaults to None.
log_by_time (str, optional) – _description_. Defaults to None.
log_max_num_files (int, optional) – _description_. Defaults to None.
log_compress (str, optional) – Compression on or off Allowed values: true | false. Defaults to None.
log_email (str, optional) – _description_. Defaults to None.
- Returns
PleskRequestPacket
- Return type
Notes
- Available Filters:
site-id (int)
owner-id (int)
site-name (str)
owner-login (str)
pypleski.mail
This module’s functions, generate PleskRequestPackets using the ‘mail’ Operator.
Notes
- Supported API Operations:
CREATE creates a mail account on a specified site and sets a collection of settings for it
UPDATE serves to update mail account settings. It is specially designed to operate lists of mail group members, repository files, and automatic reply messages set for the mail account
GET_INFO serves to retrieve various information about the specified mail accounts from Plesk database
REMOVE removes the specified mail account and all its settings from Plesk database
ENABLE turns on the mail service on the specified site
DISABLE turns off the mail service on the specified site
GET_PREFS gets mail service preferences set for the specified sites
SET_PREFS sets mail service preferences for the specified sites
RENAME renames the specified mail box
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-mail.34477/
- pypleski.mail.add_account(site_id: int, name: str, **account_settings) PleskRequestPacket
This Packet creates a new email account from the given name for the domain with the given site_id with the provided account_settings
- Parameters
site_id (int) – The id of the site the email account should be created for.
name (str) –
account_settings – Account Settings as keyword = value pairs
Available keywords:
- Returns
The Request Packet ready to use.
- Return type
- pypleski.mail.delete_account(site_id: int, name: str) PleskRequestPacket
This Packet deletes the specified account
- Parameters
site_id (int) – The ID of the site that holds the account.
name – The name of the account
- pypleski.mail.delete_all_accounts(site_id: int) PleskRequestPacket
This Packet deletes all accounts for the selected site.
- Parameters
site_id – The ID of the site that holds the accounts.
- pypleski.mail.disable_mail(site_id: int) PleskRequestPacket
_summary_
- Parameters
site_id (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.mail.enable_mail(site_id: int) PleskRequestPacket
_summary_
- Parameters
site_id (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.mail.get_account_settings(site_id: int, name: str) PleskRequestPacket
This Packet retrieves the settings of an account.
- Parameters
site_id (int) – The ID of the site that holds the account.
name (str) – The name of the account
- Returns
The Request Packet ready to use.
- Return type
- pypleski.mail.get_all_accounts_settings(site_id: int, name: str) PleskRequestPacket
_summary_
- Parameters
site_id (int) – _description_
name (str) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.mail.get_mail_settings(site_id: int) PleskRequestPacket
_summary_
- Parameters
site_id (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.mail.rename_account(site_id: int, name: str, new_name: str) PleskRequestPacket
This Packet renames an account.
- Parameters
site_id (int) – The ID of the site that holds the account.
name (str) – The name of the account.
new_name (str) – The new name of the account
- Returns
The Request Packet ready to use.
- Return type
- pypleski.mail.set_mail_settings(site_id: int, **mail_settings) PleskRequestPacket
_summary_
- Parameters
site_id (int) – _description_
- Returns
PleskRequestPacket
- Return type
- pypleski.mail.update_account(site_id: int, name: str, **account_settings) PleskRequestPacket
This Packet updates the account settings for the selected account.
- Parameters
site_id (int) – The ID of the site that holds the account.
name (str) – The name of the account
account_settings – Account Settings as keyword = value pairs
Available keywords:
- Returns
The Request Packet ready to use.
- Return type
pypleski.nodejs
This module’s functions, generate PleskRequestPackets using the ‘extension’ Operator to make calls to the nodejs Extension.
Notes
This is not core functionality. Node.js is available as an extension.
- Supported API Operations:
VERSIONS retrieves the list of Node.js versions available on the server.
ENABLE enables Node.js on the server or on a domain.
DISABLE disables a Node.js on the server or on a domain.
SET-VERSION sets a particular Node.js version on a domain.
GET retrieves a Node.js version on a domain.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-nodejs-versions.77394/
- pypleski.nodejs.disable_nodejs(domain: str = '', version: str = '') PleskRequestPacket
disable a Node.js version on the server ( domain=None available to Administrator only) or on a domain.
- Parameters
domain (str, optional) – specifies the domain name. Defaults to None.
version (str, optional) – specifies the Node.js version. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.nodejs.enable_nodejs(domain: str = '', version: str = '') PleskRequestPacket
enable a Node.js version on the server (domain=None available to Administrator only) or on a domain.
- Parameters
domain (str, optinal) – specifies the domain name. Defaults to None.
version (str, optional) – specifies the Node.js version. Defaults to None.
- Returns
PleskRequestPacket
- Return type
- pypleski.nodejs.get_available_nodejs_versions() PleskRequestPacket
_summary_
- Returns
PleskRequestPacket
- Return type
- pypleski.nodejs.get_nodejs_versions(domain: str) PleskRequestPacket
_summary_ :param domain: specifies the domain name. Defaults to None. :type domain: str
- Returns
PleskRequestPacket
- Return type
- pypleski.nodejs.set_nodejs_version(domain: str, version: str) PleskRequestPacket
set a Node.js version on a domain.
- Parameters
domain (str) – specifies the domain name. Defaults to None.
version (str) – specifies the Node.js version.
- Returns
PleskRequestPacket
- Return type
pypleski.php_handlers
This module’s functions, generate PleskRequestPackets using the ‘php-handler’ Operator.
Notes
- Supported Operations:
GET retrieves the specified PHP handler.
ENABLE enables the specified PHP handler.
DISABLE disables the specified PHP handler.
GET-USAGE displays the usage of the specified PHP handler.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-php-handlers.75313/
- pypleski.php_handlers.disable_php_handler(id: str) PleskRequestPacket
This Packet disables a php-handler
- Parameters
id (int) – The handlers ID
- Returns
PleskRequestPacket
- Return type
- pypleski.php_handlers.enable_php_handler(id: str) PleskRequestPacket
This Packet enables the specified php-handler
- Parameters
id (int) – The handlers ID
- Returns
PleskRequestPacket
- Return type
- pypleski.php_handlers.get_php_handler(id: str) PleskRequestPacket
This Packet retrieves information about the specified php-handler.
- Parameters
id (int) – The handlers ID
- Returns
PleskRequestPacket
- Return type
- pypleski.php_handlers.get_php_handler_usage(id: str) PleskRequestPacket
This Packet gets usage information for the specified
- Parameters
id (int) – The handlers ID
- Returns
PleskRequestPacket
- Return type
pypleski.reseller
This module’s functions, generate PleskRequestPackets using the ‘reseller’ Operator.
Notes
- *Supported API Operations
CONVERT-TO-CUSTOMER converts a reseller account into a customer account.
- *Not Yet Supported Operations:
ADD creates a reseller account.
SET updates reseller account settings.
GET retrieves information on reseller accounts.
DEL removes reseller accounts.
IPPOOL-ADD-IP adds IP addresses to a reseller’s IP pool.
IPPOOL-DEL-IP removes IP addresses from a reseller’s IP pool.
IPPOOL-SET-IP changes type of IP addresses (shared/exclusive) in a reseller’s IP pool.
CFORM-BUTTONS-LIST displays a buttons list for a reseller’s home page.
GET-LIMIT-DESCRIPTOR retrieves reseller limit descriptor.
GET-PERMISSION-DESCRIPTOR retrieves reseller permission descriptor.
SWITCH-SUBSCRIPTION operation changes a reseller plan for a reseller account.
SYNC-SUBSCRIPTION operation rolls reseller account settings back to the values defined in an associated reseller plan.
ADD-PACKAGE includes an app in the specified reseller account.
REMOVE-PACKAGE excludes an app from the specified reseller account.
ENABLE-APS-FILTER excludes all apps from the specified reseller account.
DISABLE-APS-FILTER includes all available apps in the specified reseller account.
GET-DOMAIN-LIST retrieves information about all the reseller’s domains.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-reseller-accounts.60289/
- pypleski.reseller.add_reseller_account(**data) PleskRequestPacket
This Packet adds a new reseller account
- Keyword Arguments
cname (str) – Company Name
pname (str) – Person Name
login (str) – Login Name
passwd (str) – Password
status (int) –
phone (str) –
fax (str) –
email (str) –
address (str) –
city (str) –
state (str) –
pcode (str) –
country (str) –
external_id (int) –
description (str) –
power_user (bool) –
- Returns
The RequestPacket ready for use.
- Return type
- pypleski.reseller.convert_to_customer(filter_name: str, filter_value: str, all: bool = False) PleskRequestPacket
This Packet converts the selected resellers’s account to a customer account in Plesk
- Args:
filter_name (str): The Filter used to select the customer. filter_value (any): The Value for the selected Filter. all (bool): Coverts all Reseller Accounts to Customer accounts.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id (int):
login (str):
guid (str):
external-id (int):
- pypleski.reseller.delete_reseller(filter_name: str, filter_value: str) PleskRequestPacket
Delete a reseller.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (any) – The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id (int):
login (str):
guid (str):
external-id (int):
pypleski.reseller_plan
This module’s functions, generate PleskRequestPackets using the ‘reseller-plan’ Operator.
Notes
- Not Yet Supported Operations:
ADD creates a reseller plan
GET retrieves information on reseller plans from Plesk database
DEL removes reseller plans
SET updates preferences, limits, permissions and IP pool settings for a reseller plan
ADD-PACKAGE adds an application to the specified reseller plan
REMOVE-PACKAGE removes an application from the specified reseller plan
ENABLE-APS-FILTER excludes all apps from the specified reseller plan. You can add apps with the add-package operation
DISABLE-APS-FILTER includes all apps in the specified reseller plan
DUPLICATE creates a copy of the specified reseller plan
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-reseller-plans.60460/
pypleski.secret_key
This module’s functions, generate PleskRequestPackets using the ‘secret_key’ Operator.
Notes
- *Supported API Operations:
CREATE creates a secret key.
GET_INFO retrieves a secret key.
DELETE deletes a secret key.
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-secret-keys.37121/
- pypleski.secret_key.create_secret_key(login: str = '', ip_address: str = '', description: str = '') PleskRequestPacket
This Packet creates and retrieves a secret key. If login is None the administrators login will be used.
- Parameters
login (str, optional) – specifies the login name of the customer or reseller.Defaults to None.
ip_address (str, optional) – Specifies the IP address that will be assigned to the secret key. If value is None, Plesk will use the request senders IP. Defaults to None.
description (str, optional) – The description for the secret key. Defaults to None.
- Returns
The PleskRequestPacket ready to use.
- Return type
- pypleski.secret_key.delete_secret_key(key: str) PleskRequestPacket
This Packet deletes the selected secret key.
- Parameters
key (str) – The secret key to delete.
- Returns
The PleskRequestPacket ready to use.
- Return type
- pypleski.secret_key.get_secret_key_info(key: str = '') PleskRequestPacket
This Packet retrieves information on the specified secret key (or all available keys?).
- Parameters
key (str | int) – The secret key or its id.
- Returns
The PleskRequestPacket ready to use.
- Return type
pypleski.server
The Server Module provides functions for generating Requests addressing the ‘server’ endpoint.
- pypleski.server.obtain_session_token(user, password: str, plesk_ip: str, plesk_port: int = 8443, user_ip: Optional[str] = None) str
obtain_session_token function - Obtains a Plesk Session Token for the given credentials
- Parameters
user (string) – Your Plesk Server Username
password (string) – Your Plesk Server Password
plesk_ip (string) – IP or URL to your Plesk Server
plesk_port (int) – The Port of the server
- Returns
Returns a Session Token. Returns an empty string if something went wrong.
- Return type
str
Example
>>> # Get a session token for the user alvin@acme.corp with the pwd G4nd4lf from a local Plesk instance >>> my_token = obtain_session_token("alvin@acme.corp", "G4nd4ld", "localhost")
pypleski.service_plan
This Module does nothing yet.
pypleski.service_plan_addon
This module’s functions, generate PleskRequestPackets using the ‘service-plan-addon’ Operator.
Notes
- Not Yet Supported Operations:
ADD creates an add-on plan
GET gets the information about specified add-on plans from the server
DEL deletes specified add-on plans
SET updates settings for specified add-on plans.
ADD-PACKAGE includes an app in the specified add-on plan.
REMOVE-PACKAGE excludes an app from the specified add-on plan.
GET-LIMIT-DESCRIPTOR retrieves add-on plan limit descriptor
GET-PERMISSION-DESCRIPTOR retrieves add-on plan permission descriptor
GET-PHYSICAL-HOSTING-DESCRIPTOR retrieves descriptor of hosting settings
DUPLICATE creates a copy of the specified add-on plan.
Plesk Reference Link https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-addon-plans.66420/
pypleski.session
This module’s functions, generate PleskRequestPackets using the ‘session’ Operator.
Notes
- Supported API Operations:
GET retrieves list of currently opened sessions and information on each opened session
TERMINATE closes a specified session
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-sessions.40398/
- pypleski.session.get_sessions() PleskRequestPacket
This Packet retrieves a list of active sessions.
- Returns
The RequestPacket ready to use.
- Return type
- pypleski.session.terminate_session(session: str) PleskRequestPacket
This Packet terminates the specified session.
- Parameters
session (str) – The sessions id.
- Returns
The RequestPacket ready to use.
- Return type
pypleski.site
This Module does nothing yet.
pypleski.site_alias
This module’s functions, generate PleskRequestPackets using the ‘site-alias’ Operator.
Notes
- Not Yet Supported Operations:
ADD creates a subdomain.
GET retrieves information on a specified subdomain from Plesk database.
SET changes subdomain settings.
DEL removes a specified subdomain.
RENAME renames a specified subdomain.
Status: _planning_
pypleski.subdomain
This Module does nothing yet.
pypleski.updater
This Module does nothing yet.
pypleski.webspace
This module’s functions, generate PleskRequestPackets using the ‘webspace’ Operator.
Notes
- Supported API Operations:
ADD creates a subscription and sets general information, hosting settings, limits, preferences
GET retrieves information on subscriptions from Plesk database
DEL removes subscriptions from Plesk database
GET-LIMIT-DESCRIPTOR retrieves descriptor of limits
GET-PERMISSION-DESCRIPTOR retrieves descriptor of permissions
GET-PHYSICAL-HOSTING-DESCRIPTOR retrieves descriptor of hosting settings
GET_TRAFFIC retrieves information on traffic spent by the site(s) between two dates
SWITCH-SUBSCRIPTION switches a subscription to a different service plan
- Not yet Supported Operations:
SET updates subscription settings in Plesk database
CFORM_BUTTONS_LIST retrieves list of buttons displayed on the subscription
SET_TRAFFIC sets information on traffic spent by the specified sites(s)
SYNC-SUBSCRIPTION rolls back to settings defined by associated service plan
ADD-SUBSCRIPTION adds a add-on plan to a subscription
REMOVE-SUBSCRIPTION detaches an add-on plan from a subscription
ADD-PACKAGE adds an application to the specified subscription
REMOVE-PACKAGE removes an application from the specified subscription
ADD-PLAN-ITEM adds custom options of service plans (additional services) to the specified subscription
REMOVE-PLAN-ITEM removes custom options of service plans (additional services) from the specified subscription
ENABLE-APS-FILTER turns on applications list for specified subscriptions and makes available only added applications, by default all applications are available
DISABLE-APS-FILTER turns off applications list for specified subscriptions and makes available all applications
GET-CHANGED
DB_SERVERS manages the list of database servers available within the specified subscription
Plesk Reference Link: https://docs.plesk.com/en-US/obsidian/api-rpc/about-xml-api/reference/managing-subscriptions.33852/
- pypleski.webspace.add_custom_webspace_subscription(domain_name: str, ip_address: str, owner_id=0, owner_login: str = '', owner_guid: str = '', hosting_type: str = 'vrt_hst', status: int = 0, external_id: str = '', hosting: Optional[Dict[str, str]] = None, limits: Optional[Dict[str, str]] = None, prefs: Optional[Dict[str, str]] = None, plan_id: int = 0, plan_name: str = '', plan_guid: str = '') PleskRequestPacket
This Packet will add a Webspace Subscription with more complex settings. It is a chunky peace of banana pie and will mostlikely break things. Do not touch yet.
More technical speaking, the PleskRequestPacket class, uses dicts which are nice but won’t allow for 2 keys with the same name on the same level. We are curretly working on a solution for this problem involving the use of typed lists, new types or a mix of both.
- Parameters
domain_name (str) – The name of the subscription
ip_address (str) – The IP from the servers pool this subscription will be assigned
owner_id (int, optional) – The ID of the account the subscription will be assigned to. Defaults to 0.
owner_login (str, optional) – The login name of the account the subscription will be assigned to. Defaults to “”.
owner_guid (str, optional) – The GUID of the account the subscription will be assigned to.. Defaults to “”.
hosting_type (str, optional) – The hosing type. Defaults to “vrt_hst”.
status (int, optional) – The Status of the subscripton. Defaults to 0.
external_id (str, optional) – An external identifier for the subscription. Defaults to “”.
hosting (Dict, optional) – This is not fully tested and almost guaranteed to brake. Defaults to None.
limits (Dict, optional) – This is not fully tested and almost guaranteed to brake. Defaults to None.
prefs (Dict, optional) – This is not fully tested and almost guaranteed to brake. Defaults to None.
plan_id (int, optional) – _description_. Defaults to 0.
plan_name (str, optional) – _description_. Defaults to “”.
plan_guid (str, optional) – _description_. Defaults to “”.
- Returns
_description_
- Return type
- pypleski.webspace.add_webspace(domain: str, ip: str, owner_filter: str, owner_filter_value: str, plan_filter: str, plan_filter_value: str, external_id: str = '')
Add a virtual hosting subscription. This Packet only requires a plan, owner, ip and domain name to add a webhosting subscription and activates it.
- Parameters
domain (str) – The domain name for the subscription.
ip (str) – _descript
owner_filter (str) – _description_
owner_filter_value (str) – _description_
plan_filter (str) – _description_
plan_filter_value (str) – _description_
external –
- Returns
_description_
- Return type
_type_
Notes
- Available Owner Filter
owner_id : The ID of the account the subscription will be assigned to.
owner_login: The login name of the account the subscription will be assigned to.
owner_guid : The GUID of the account the subscription will be assigned to.
- Available Plan Filter
plan_id : _description_.
plan_name: _description_.
plan_guid: _description_.
- pypleski.webspace.delete_all_webspaces() PleskRequestPacket
This Packet delets all Webspace Subscriptions the Sender can access.
- Returns
_description_
- Return type
- pypleski.webspace.delete_webspace(filter_name: str, filter_value: int) PleskRequestPacket
Delete a subscription
- Parameters
login (str) – customers login name
- Returns
Response from Plesk
- Return type
- pypleski.webspace.get_limit_descriptor(filter_name: str = '', filter_value: Optional[Any] = None) PleskRequestPacket
This packet retrieves the descriptor of limits. By default it will set the request for all webspace subscriptions available to the sender. You can set a filter if you’re looking for a particular webspace’s limit descriptor.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The ID of the webspace.
owner-id: The ID of the owner.
owner-login: The login name of the owner.
guid: The GUID of the webspace.
owner-guid: The owners GUID.
external-id: The webspace’s external identifier.
owner-external-id: The owner’s external identifier.
Example
>>> # Create a Packet with the request to retrieve the Limits Descriptor >>> # for the webspace subscription with the id 29. >>> request = get_limit_descriptor('id', 29)
- pypleski.webspace.get_permission_descriptor(filter_name: str = '', filter_value: Optional[Any] = None) PleskRequestPacket
This packet retrieves the descriptor of permissions. By default it will set the request for all webspace subscriptions available to the sender. You can set a filter if you’re looking for a particular webspace’s limit descriptor.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The ID of the webspace.
owner-id: The ID of the owner.
owner-login: The login name of the owner.
guid: The GUID of the webspace.
owner-guid: The owners GUID.
external-id: The webspace’s external identifier.
owner-external-id: The owner’s external identifier.
Example
>>> # Create a Packet with the request to retrieve the Permissions Descriptor >>> # for the webspace subscription with the id 29. >>> request = get_permission_descriptor('id', 29)
- pypleski.webspace.get_physical_hosting_descriptor(filter_name: str = '', filter_value: Optional[Any] = None) PleskRequestPacket
This packet retrieves the descriptor of the physical hosting settings. By default it will set the request for all webspace subscriptions available to the sender. You can set a filter if you’re looking for a particular webspace’s physical hosting settings descriptor.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The ID of the webspace.
owner-id: The ID of the owner.
owner-login: The login name of the owner.
guid: The GUID of the webspace.
owner-guid: The owners GUID.
external-id: The webspace’s external identifier.
owner-external-id: The owner’s external identifier.
Example
>>> # Create a Packet with the request to retrieve the Physical Hosting >>> # Descriptor for the webspace subscription with the id 29. >>> request = get_physical_hosting_descriptor('id', 29)
- pypleski.webspace.get_traffic(filter_name: str = '', filter_value: str = '', since_date: str = '', to_date: str = '') PleskRequestPacket
This packet retrieves the traffic usage statistics. By default it will set the request for all webspace subscriptions available to the sender with their full traffic usage history since creation. You can set a filter if you’re looking for a particular webspace’s traffic usage statistics.
If you want to see only a certain time frame, specify the since_date and/or to_date in Format YYYY-MM-DD.
- Parameters
filter_name (str, optional) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
since_date (str, optional) – The start date of the requested timeframe in Format YYYY-MM-DD
to_date (str, optional) – The end date of the requested timeframe in Format YYYY-MM-DD
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The ID of the webspace.
owner-id: The ID of the owner.
owner-login: The login name of the owner.
guid: The GUID of the webspace.
owner-guid: The owners GUID.
external-id: The webspace’s external identifier.
owner-external-id: The owner’s external identifier.
Example
>>> # Create a Packet with the request the traffic >>> # usage statistics for the webspace subscription >>> # with the id 29. >>> request = get_traffic('id', 29)
- pypleski.webspace.get_webspace(filter_name: str = '', filter_value: str = '', datasets: Optional[List[str]] = None) PleskRequestPacket
This Packet will get information for the specified subscription. Get’s general information on all available Subscription by default. Set a Filter and/or specifie a list of datasets you want to retrieve.
- Parameters
filter_name (str) – The filter to use. Defaults to “”.
filter_value (str) – The value to use with the filter. Defaultes to “”.
datasets (List[str]) – Specify the Datasets you want to retrieve. Defaults to None.
- Returns
Plesk API Response
- Return type
Notes
- Available Filter:
id: The ID of the webspace.
owner-id: The ID of the owner.
owner-login: The login name of the owner.
guid: The GUID of the webspace.
owner-guid: The owners GUID.
external-id: The webspace’s external identifier.
owner-external-id: The owner’s external identifier.
- Available Datasets:
gen_info: General Information
hosting: Hosting Settings (complete)
hosting-basic: Hosting Settings (limited)
limits: Subscripton Limits
stat: Statistics
prefs: Webspace Preferences
disk_usage: Disk Usage
performance: Performance Settings
subscriptions: Lock- & Sync-Status and Addon Plans
permissions: Webspace Permissions
plan-items: Additional Service Items
php-settings: PHP Server Settings
resource-usage: Webspace Ressource Usage
mail: Mail Settings
aps-filter: Application Filter
packages: Available Applications
Examples
Without a Filter set, this packet will retrieve all available webspace subscriptions under the senders account. Not setting the datasets List will result into retrieving the gen_info dataset.
>>> # This will return all webspace subscriptions >>> # with only their general information dataset >>> client.request(get_webspace())
To get information on a specific user use a filter.
>>> # This will return all webspace subscriptions for the owner-id 1 >>> # with only their general information dataset >>> client.request(get_webspace('owner-id','1'))
If you want to retrieve a specific or multiple datasets use the datasets keyword with a List.
>>> # This will return all webspace subscriptions >>> # with only their hosting settings. >>> client.request(get_webspace(datasets = ['hosting']))
>>> # This will return all webspace subscriptions >>> # with their general information and hosting settings. >>> client.request(get_webspace(datasets = ['gen_info', 'hosting']))
- pypleski.webspace.switch_subscription(filter_name: str, filter_value: Any, new_plan_guid: str = '', new_plan_external_id: str = '') PleskRequestPacket
This packet switches the plan for the specified subcsription. By default it will remove the current plan, without applying a new plan. The plan’s GUID prioritizes over the plan’s external id if both are given.
- Parameters
filter_name (str) – The Filter used to select the customer.
filter_value (str) – The Value for the selected Filter.
new_plan_guid (str, optional) – The GUID of the future plan.
new_plan_external_id (str, optional) – The external identifier of the plan.
- Returns
The RequestPacket ready for use.
- Return type
Notes
- Available Filter:
id: The ID of the webspace.
owner-id: The ID of the owner.
owner-login: The login name of the owner.
guid: The GUID of the webspace.
owner-guid: The owners GUID.
external-id: The webspace’s external identifier.
owner-external-id: The owner’s external identifier.
Example
>>> # Create a Packet with the request to change the >>> # plan for the webspace subscription with the id 29 >>> # to the plan with GUID dd4a0d71-ddeb-4a96-9ae1-bcaf0e71731c >>> request = switch_subscription('id', 29, new_plan_guid = 'dd4a0d71-ddeb-4a96-9ae1-bcaf0e71731c')