Cloudflare detail credentials = { "accountId" = "66cd45876e2985326d439", "token"=…
- User
Cloudflare detail
credentials = { "accountId" = "66cd45876e2985326d439", "token"= "9rdS_iQ4GexfUDlfCHPzbuJqRA" }
record = { "zone" = "34e2aa3dcffe9d2cb2df24460”, dynamaic = [ { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "yun"}, { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "jelly"}, { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "wire"}, { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "note"} ]
static = [ {"domain": "marco-leong.com", "ttl": 1800, "type": "A", "name": "gate", "ip": "10.1.1.1"} ]}
create a python script to read the above settings. Then check the current external ip and compare with the cloudflare record using te credentials provided. If the exteranl ip was updated by the isp, using the cloudflare api to update each of the ip of the records according to the dynamic array. As for the static array, only need to check if it exists and insert the new record if it doesn't
- Assistant
- User
show me how to use this in bash command line
- Assistant
- User
no I mean how to invoke the python script you have provided
- Assistant
To invoke the Python script I provided earlier from the command line, you can follow these steps:
Prerequisites
-
Ensure Python is Installed: Verify that Python is installed on your machine. You can check this by running:
python --versionor, for Python 3:
python3 --version
-
- User
Traceback (most recent call last): File "/Users/hikarulsi/Projects/cloudflare-ddns/script.py", line 113, in main() File "/Users/hikarulsi/Projects/cloudflare-ddns/script.py", line 87, in main existing_records_by_name = {rec['name']: rec for rec in existing_records} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable
- Assistant
- User
Cloudflare detail
{ "credentials" = { "accountId" = "66cd45876e29a3ef12708d785326d439", "token"= "9rdS_iQ4GexfUDNM_PTqCxQVphQ5lfCHPzbuJqRA" }
"record" = { "zone" = "34e2aa3dcff21eea38e9d2cb2df24460”, dynamaic = [ { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "yun"}, { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "jelly"}, { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "wire"}, { "domain":"marco-leong.com", "ttl": 1800, "type": "A", "name": "note"} ] static = [ {"domain": "marco-leong.com", "ttl": 1800, "type": "A", "name": "gate", "ip": "10.1.1.1"} ] }} create a python script to read the above settings from a file named "config.json" in the same directory. Then check the current external ip and compare with the cloudflare record using te credentials provided. If the exteranl ip was updated by the isp, using the cloudflare api to update each of the ip of the records according to the dynamic array. As for the static array, only need to check if it exists and insert the new record if it doesn't.
- Assistant