From 7fe1b0b44df764d110863d13f662425ec0e8b976 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Mon, 13 May 2024 22:41:38 -0600 Subject: [PATCH] Adopt the new bearer auth for PATs --- projects/gandi/src/gandi/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/gandi/src/gandi/client.py b/projects/gandi/src/gandi/client.py index 9de8052..cedbefd 100644 --- a/projects/gandi/src/gandi/client.py +++ b/projects/gandi/src/gandi/client.py @@ -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)