CPanel API Client. Supports cPanel API 2 and UAPI.
Project description
CPanel API Client for Python
Supports cPanel API 2 and UAPI.
$ pip install cpanel-api
Basic usage:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
from cpanel_api import *
logging.basicConfig(level=logging.DEBUG, stream=sys.stderr)
hostname = 'HOSTNAME_OR_IPADRESS'
username = 'USERNAME'
password = 'PASSWORD'
client = CPanelApi(hostname, username, password)
Domain list:
In [10]: client.uapi.DomainInfo.list_domains()
Out [10]:
{'messages': None,
'status': 1,
'data': {'main_domain': 'site.info',
'sub_domains': ['cabinet.site.info',
'news.site.info',
'shop.site.info'],
'parked_domains': [],
'addon_domains': []},
'errors': None,
'metadata': {},
'warnings': None}
SSH kyes:
In [20]: client.cpanel2.SSH.listkeys()
Out [20]:
{'cpanelresult': {'postevent': {'result': 1},
'apiversion': 2,
'preevent': {'result': 1},
'module': 'SSH',
'func': 'listkeys',
'data': [],
'event': {'result': 1}}}
Function call syntax:
client.api_version.ModuleName.function_name({'param': 'value'})
client.api_version.ModuleName.function_name(param='value')
client.api_version.ModuleName.function_name({'param': 'value'}, param='value')
client.api_cal('version', 'ModuleName', 'function_name', {'param': 'value'}, param='value')
Links:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cpanel-api-0.2.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for cpanel_api-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbc2c74e3929d98746e347595299a62aa78ab3027c969cc2928de5b6a4d6d10a |
|
MD5 | 786903dd52327eca6faf70bb46acb82d |
|
BLAKE2b-256 | 3e5c29d6537e5b94982bff3db96a3489cdf0038a606958b3dfd90993782af943 |