CPanel API Client. Supports cPanel API 2 and UAPI.
Project description
CPanel API Client for Python
Supports cPanel API 2 and UAPI.
Install
$ pip install cpanel-api
Examples
Create client:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
from cpanel_api import *
logging.basicConfig(level=logging.WARNING, stream=sys.stderr)
hostname = 'HOSTNAME_OR_IPADRESS'
username = 'USERNAME'
password = 'PASSWORD'
client = CPanelApi(hostname, username, password)
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('api_version', 'ModuleName', 'function_name', {'param': 'value'}, param='value')
Where api_version
is cpanel2
or uapi
.
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}}}
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.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for cpanel_api-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a15660e0919e7a000854c1856e18cde5863bed6b16b38b7093a068afdeb1b876 |
|
MD5 | 05ecbbfc51d8ad780f5597b25a1df870 |
|
BLAKE2b-256 | a43727132b6d8248cac93d7d493b27b300bb1d26332d8bc4fbfc5a97a118c1bf |