Adopt the new bearer auth for PATs
This commit is contained in:
parent
1ad35f95f1
commit
7fe1b0b44d
1 changed files with 2 additions and 2 deletions
|
@ -20,7 +20,7 @@ class GandiAPI(object):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, key=None, use_cache=True):
|
||||
def __init__(self, key: str, use_cache: bool =True):
|
||||
self._base = "https://dns.api.gandi.net/api/v5"
|
||||
self._key = key
|
||||
self._use_cache = use_cache
|
||||
|
@ -30,7 +30,7 @@ class GandiAPI(object):
|
|||
|
||||
def _do_request(self, method, path, headers=None, **kwargs):
|
||||
headers = headers or {}
|
||||
headers["X-Api-Key"] = self._key
|
||||
headers["Authorization"] = "Bearer " + self._key
|
||||
resp = method(self._base + path, headers=headers, **kwargs)
|
||||
if resp.status_code > 299:
|
||||
print(resp.text)
|
||||
|
|
Loading…
Reference in a new issue