mirror of
https://github.com/timothymiller/cloudflare-ddns.git
synced 2026-03-21 22:48:57 -03:00
Add support for new API tokens.
This commit is contained in:
@@ -83,11 +83,17 @@ def commitRecord(ip):
|
||||
|
||||
|
||||
def cf_api(endpoint, method, config, headers={}, data=False):
|
||||
headers = {
|
||||
"X-Auth-Email": config['account_email'],
|
||||
"X-Auth-Key": config['api_key'],
|
||||
**headers
|
||||
}
|
||||
api_token = config['authentication']['api_token']
|
||||
if api_token != '' and api_token != 'api_token_here':
|
||||
headers = {
|
||||
"Authorization": "Bearer " + config['authentication']['api_token'],
|
||||
**headers
|
||||
}
|
||||
else:
|
||||
headers = {
|
||||
"X-Auth-Email": config['authentication']['api_key']['account_email'],
|
||||
"X-Auth-Key": config['authentication']['api_key']['api_key'],
|
||||
}
|
||||
|
||||
if(data == False):
|
||||
response = requests.request(
|
||||
@@ -98,7 +104,6 @@ def cf_api(endpoint, method, config, headers={}, data=False):
|
||||
|
||||
return response.json()
|
||||
|
||||
|
||||
for ip in getIPs():
|
||||
print("Checking " + ip["type"] + " records")
|
||||
commitRecord(ip)
|
||||
|
||||
Reference in New Issue
Block a user