Skip to main content

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)

Uploaded Source

Built Distribution

cpanel_api-0.2.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page