-
Notifications
You must be signed in to change notification settings - Fork 917
Python API Client
Jason White edited this page Dec 15, 2020
·
4 revisions
- Generated by Swagger Codegen
- PyPI package: https://pypi.org/project/powerdns-client/
- Source code master: https://github.com/nrfta/python-powerdns-client
- Source code generator: https://github.com/nrfta/python-powerdns-client/tree/codegen
Python 2.7 and 3.4+
pip install powerdns-client
Then import the package:
import powerdns_client
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import powerdns_client
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import powerdns_client
from powerdns_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: APIKeyHeader
configuration = powerdns_client.Configuration()
configuration.api_key['X-API-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-API-Key'] = 'Bearer'
# create an instance of the API class
api_instance = powerdns_client.ConfigApi(powerdns_client.ApiClient(configuration))
server_id = 'server_id_example' # str | The id of the server to retrieve
try:
# Returns all ConfigSettings for a single server
api_response = api_instance.get_config(server_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ConfigApi->get_config: %s\n" % e)
See README
Please also read the PowerDNS Documentation that is available from https://doc.powerdns.com/