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)
Metadata
Release files for plesk-api 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| plesk_api-0.0.1.tar.gz | 10.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| plesk_api-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.2 kB
Release files / plesk_api-0.0.1.tar.gz
| Download URL | plesk_api-0.0.1.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7502988b11ae9106a181c143ee6adaad657a1023c9c7d31e4f3c95a9650bd1ab
|
|
BLAKE2b-256 checksum How to use checksums |
18245dd09d78cb3d48569754f3d37941edc542ee1ef2e2bb00d96f23d6cb0c98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / plesk_api-0.0.1-py3-none-any.whl
| Download URL | plesk_api-0.0.1-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b41dbdc7955bcf7da834a12e1f92e00f871219d312e411642370183dd5c9f1df
|
|
BLAKE2b-256 checksum How to use checksums |
a2dff2870c58a94b86522ba6fdb3bd3347add0cc9941656161da2fcdd5601bc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|