mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #99 from poblahblahblah/allow-https-for-powerdns
Allow proto to be specified for powerdns
This commit is contained in:
@@ -18,11 +18,13 @@ class PowerDnsBaseProvider(BaseProvider):
|
|||||||
'SPF', 'SSHFP', 'SRV', 'TXT'))
|
'SPF', 'SSHFP', 'SRV', 'TXT'))
|
||||||
TIMEOUT = 5
|
TIMEOUT = 5
|
||||||
|
|
||||||
def __init__(self, id, host, api_key, port=8081, *args, **kwargs):
|
def __init__(self, id, host, api_key, port=8081, scheme="http", *args,
|
||||||
|
**kwargs):
|
||||||
super(PowerDnsBaseProvider, self).__init__(id, *args, **kwargs)
|
super(PowerDnsBaseProvider, self).__init__(id, *args, **kwargs)
|
||||||
|
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
|
self.scheme = scheme
|
||||||
|
|
||||||
sess = Session()
|
sess = Session()
|
||||||
sess.headers.update({'X-API-Key': api_key})
|
sess.headers.update({'X-API-Key': api_key})
|
||||||
@@ -31,8 +33,8 @@ class PowerDnsBaseProvider(BaseProvider):
|
|||||||
def _request(self, method, path, data=None):
|
def _request(self, method, path, data=None):
|
||||||
self.log.debug('_request: method=%s, path=%s', method, path)
|
self.log.debug('_request: method=%s, path=%s', method, path)
|
||||||
|
|
||||||
url = 'http://{}:{}/api/v1/servers/localhost/{}' \
|
url = '{}://{}:{}/api/v1/servers/localhost/{}' \
|
||||||
.format(self.host, self.port, path)
|
.format(self.scheme, self.host, self.port, path)
|
||||||
resp = self._sess.request(method, url, json=data, timeout=self.TIMEOUT)
|
resp = self._sess.request(method, url, json=data, timeout=self.TIMEOUT)
|
||||||
self.log.debug('_request: status=%d', resp.status_code)
|
self.log.debug('_request: status=%d', resp.status_code)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
|
|||||||
Reference in New Issue
Block a user