Skip to main content

Python module for SOLIDserver REST API

Project description

EipRest - Simple Solidserver REST client

Python implementation of SOLIDserver REST client.

Install

python3 -m pip install eiprest

Usage

As standalone executable script:

  • Using simple parameter format
    python -m eiprest -s solidserver.test.com dns_server_info dns_id=3
  • Using json format
    python -m eiprest --server 10.0.99.99 dns_server_info '{"dns_id":3}'

Run python -m eiprest -h to see all command line options.

As python module in another script:

from eiprest import EipRest
rest = EipRest(host='1.2.3.4', user='ipmadmin', password='admin', debug=True)
params = {'dns_id': 3}
rest.query('GET', 'dns_server_info',  params)
if rest.resp is not None:
  print('Response status: ', rest.resp.status_code)
  response_data = rest.getData()

Advanced Usage

EipRest Object Methods

EipRest(host, user, password, debug=False)

  • host: SOLIDserver hostname or IP address
  • user: SOLIDserver valid login name
  • password: SOLIDserver valid login password
  • debug: enable more verbose output

query(method, service, params=None, payload=None)

  • method: HTTP methods support only GET, POST, PUT, DELETE, and OPTIONS
    Use GET for all *_list services (dns_server_list, dhcp_scope_list, etc.) and *_info services (dns_server_info, dhcp_scope_info, etc.).
    DELETE are reserved for all *_delete services.
    For *_add services, PUT (create) or POST (update) should be used.
    Use OPTIONS without any parameters to get all available input and output parameters of the service.
  • service: SOLIDserver API service name
  • params: Python dictionary containing service parameters
  • payload: Python dictionary containing additional parameters (optional)

rpc(method, service, params=None, payload=None)

Same as query method except that there is no input parameter validation check. Also this is the only way to call SOLIDserver macro in REST API.

Ex.

rest.rpc('POST', 'clish_force_ntp_update.php')

getLastUrl()

Return last URL called.

getData()

Return HTTP response data.

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

eiprest-1.1.tar.gz (5.4 kB view hashes)

Uploaded source

Built Distribution

eiprest-1.1-py3-none-any.whl (6.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page