Skip to main content

WHM Api interface

Project description

>>> ========================================================== <<<
>>>              _                                             <<<
>>>   __      __| |__    __ _  _ __ ___   _ __   _   _         <<<
>>>   \ \ /\ / /| '_ \  / _` || '_ ` _ \ | '_ \ | | | |        <<<
>>>    \ V  V / | | | || (_| || | | | | || |_) || |_| |        <<<
>>>     \_/\_/  |_| |_| \__,_||_| |_| |_|| .__/  \__, |        <<<
>>>                                      |_|     |___/         <<<
>>> ========================================================== <<<

Description

This is a first version of the Python WHM API interface library While it was inspired by SIRBUGS script to create CPanels, while trying to adapt it to use as a library - it was completely reworked. In the first version only a generic function call is implemented, which allows full control of the WHM panel, but lacks "convenience" functions for mostly used specific WHM Api functions.

Setup

$ pip install whambampy

Usage

def create_cpanel():
    from whambampy import whm

    whm = whm(host='example.com', username='whmuser', api_token='mysecuretoken')
    result = whm.call(function='createacct', username='newuser', domain='new.example.com')

    if 'Creation Ok' in result['metadata'].get('reason'):
        return True

Full list of WHM Api functions can be found in api_commands.py

Documentation regarding api contracts for each function can be found at https://api.docs.cpanel.net/openapi/whm/operation/{{ function_name }}

Suggestions and contributions are always welcome. Any found bugs should be filed in issues

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

WhamBamPy-0.0.6.tar.gz (5.6 kB view hashes)

Uploaded Source

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