Just what I have...
* main.py -status command gets SOA record * main.py -push command broken (API returns 405) * dsc.py general connection to API works
This commit is contained in:
27
dsc.py
Normal file
27
dsc.py
Normal file
@ -0,0 +1,27 @@
|
||||
from __future__ import print_function
|
||||
import time
|
||||
import powerdns_client
|
||||
from powerdns_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
from decouple import config
|
||||
|
||||
# Configure API key authorization: APIKeyHeader
|
||||
configuration = powerdns_client.Configuration()
|
||||
print(f"{configuration.host=}")
|
||||
configuration.host = config('PDNS_SERVER', default='https://localhost') + '/api/v1'
|
||||
print(f"{configuration.host=}")
|
||||
configuration.api_key['X-API-Key'] = config('PDNS_APIKEY', default='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
|
||||
server_id = 'localhost'
|
||||
|
||||
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)
|
Reference in New Issue
Block a user