A simple API wrapper for Plesk
Project description
example usage:
import plesk
from plesk.definitions.Client import Client
from plesk.definitions.DomainResponse import DomainResponse
from plesk.definitions.DomainRequest import DomainRequest
from plesk.definitions.PlanReference import PlanReference
from plesk.utils import generate_password, generate_guid
panel = plesk.PleskPanel.get_singleton(username='<plesk admin/root username>', password='<plesk password>', fqdn='https://<plesk hostname or ip address>:8443', debug=True)
users: list[Client] = panel.user.fetch_all()
admin_user: Client = panel.user.fetch(customer_id=1)
admin_domains: list[DomainResponse] = admin_user.fetch_domains()
admin_first_domain: DomainResponse = admin_domains[0]
new_domain = DomainRequest(
_name='example.com',
_hosting_type='virtual',
_base_domain=None,
_parent_domain=None,
_owner_client=admin_user.to_owner_reference(),
_description='This is an example subscription made through the api',
_hosting_settings={
'ftp_login': 'example_ftp022',
'ftp_password': generate_password(),
},
_ip_addresses=['<ipv4 address to use>'],
_ipv4=['<ipv4 address to use>'],
_ipv6=[],
_plan=PlanReference(_name='Unlimited'),
)
admin_first_domain.add_domain(domain=new_domain)
new_domain_in_subscription = DomainRequest(
_name='example1.com',
_hosting_type='virtual',
_base_domain=admin_first_domain.to_domain_reference(),
_parent_domain=admin_first_domain.to_domain_reference(),
_owner_client=admin_user.to_owner_reference(),
_description='This is an example domain added to a subscription through the api',
_hosting_settings={
'ftp_login': 'example_ftp212',
'ftp_password': generate_password(),
},
_ip_addresses=['<ipv4 address to use>'],
_ipv4=['<ipv4 address to use>'],
_ipv6=[],
_plan=PlanReference(_name='Unlimited'),
)
admin_first_domain.add_domain(domain=new_domain_in_subscription)
# new_client = ClientRequest(
# _name='John Smith',
# _company='Plesk',
# _login='john-unit-test',
# _status=0,
# _email='john_smith@example.com',
# _locale='en-US',
# _owner_login=admin_user.login,
# _external_id=generate_guid(),
# _description='Nice guy',
# _password=generate_password(),
# _type='customer'
# )
# new_user = panel.user.create(client_request=new_client)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
plesk_api-0.0.1.tar.gz
(10.6 kB
view details)
Built Distribution
plesk_api-0.0.1-py3-none-any.whl
(19.6 kB
view details)
File details
Details for the file plesk_api-0.0.1.tar.gz
.
File metadata
- Download URL: plesk_api-0.0.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7502988b11ae9106a181c143ee6adaad657a1023c9c7d31e4f3c95a9650bd1ab |
|
MD5 | 1ab70e01b7f5bf3a6cf52f849891469e |
|
BLAKE2b-256 | 18245dd09d78cb3d48569754f3d37941edc542ee1ef2e2bb00d96f23d6cb0c98 |
File details
Details for the file plesk_api-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: plesk_api-0.0.1-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b41dbdc7955bcf7da834a12e1f92e00f871219d312e411642370183dd5c9f1df |
|
MD5 | 2166c7f4f569a93bd73c674f02655105 |
|
BLAKE2b-256 | a2dff2870c58a94b86522ba6fdb3bd3347add0cc9941656161da2fcdd5601bc0 |