If i try to follow the code at Cloudflare DDNS it seems like in that code it uses another approach:
It uses only these three infos to do everything
- self.username = X-Auth-Email = myemail@somewhere.org
- self.password = X-Auth-Key = Global API Key = Go to Your profile → Overview → Get your API token → Global API Key = qwertyqwertyqwertyqwerty
- self.hostname = www.mydomain.org
First with “self.username = X-Auth-Email” and “self.password = X-Auth-Key” it does something like this:
curl https://api.cloudflare.com/client/v4/zones -H "X-Auth-Email: myemail@somewhere.org" -H "X-Auth-Key: qwertyqwertyqwertyqwerty" -H "Content-Type: application/json"
And it gets:
- zone_id = zdzdzdzdzdzdzdzdzdzd
With this new info it does something like this:
curl https://api.cloudflare.com/client/v4/zones/zdzdzdzdzdzdzdzdzdzd/dns_records -H "X-Auth-Email: myemail@somewhere.org" -H "X-Auth-Key: qwertyqwertyqwertyqwerty" -H "Content-Type: application/json"
And with the info from above command and the help of self.hostname it gets
- host_id = hdhdhdhhdhdhdhdhdhd
And now it has everything it needs to check IP and change if needed
EDIT
I also just realized that the code in Cloudflare DDNS is very similar to the code in providers.py « ddns « src - ddns.git - Dynamic DNS client for IPFire. (if this is the right place to look).
In my naive eyes it looks like copying all code from the post to providers.py and changing stuff like:
requests.put(self.url bla bla ...
To
self.send_request(self.url bla bla ...
And maybe it would work with a few changes in providers.py?