updated to use gandi PATs
Reason: API Keys are deprecated
This commit is contained in:
parent
8e16fdebfd
commit
fc0d163192
@ -18,14 +18,14 @@ It is also possible to define a path to a file with the API key written in it. T
|
||||
|
||||
## Usage
|
||||
|
||||
First, get your API key from https://account.gandi.net/en/users/USER/security where `USER` is your Gandi username.
|
||||
First, get your Personal Access Token (PAT) from https://account.gandi.net/en/users/USER/security where `USER` is your Gandi username.
|
||||
|
||||
The script looks for a config file at `$HOME/.config/dyn-gandi/config.log` or `/etc/dyn-gandi.conf` in that order. So create a file at one of these locations according to the schema below.
|
||||
|
||||
```json
|
||||
{
|
||||
"api": {
|
||||
"<Your-API-Key>": {
|
||||
"<Your-PAT>": {
|
||||
"example.com": [ "@", "www", "sub1" ],
|
||||
"example.org": [ "@", "www", "sub1", "sub2" ]
|
||||
},
|
||||
|
@ -120,7 +120,7 @@ def checkRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Cal
|
||||
|
||||
records_to_renew = api
|
||||
for key, domains in api.items():
|
||||
headers = {'authorization': f"Apikey {key}"}
|
||||
headers = {'Authorization': f"Bearer {key}"}
|
||||
|
||||
for domain, _ in domains.items():
|
||||
response = requests.get(
|
||||
@ -159,7 +159,7 @@ def renewRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Cal
|
||||
|
||||
for api_key, domains in api.items():
|
||||
headers = {
|
||||
'authorization': f"Apikey {api_key}",
|
||||
'Authorization': f"Bearer {api_key}",
|
||||
'content-type': 'application/json',
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user