letsencrypt-cloudflare-hook
letsencrypt-cloudflare-hook copied to clipboard
HTTPError: 400 Client Error: Bad Request for url: https://api.cloudflare.com/client/v4/zones
I'm configuring dehydrated with CloudFlare but getting following error. I would be very happy if anyone can quick help.
ENV-Python-3.5
+ CloudFlare hook executing: deploy_challenge
Traceback (most recent call last):
File "/opt/dehydrated/hooks/cloudflare/hook.py", line 206, in <module>
main(sys.argv[1:])
File "/opt/dehydrated/hooks/cloudflare/hook.py", line 203, in main
ops[argv[0]](argv[1:])
File "/opt/dehydrated/hooks/cloudflare/hook.py", line 167, in create_all_txt_records
create_txt_record(args[i:i+X])
File "/opt/dehydrated/hooks/cloudflare/hook.py", line 105, in create_txt_record
zone_id = _get_zone_id(domain)
File "/opt/dehydrated/hooks/cloudflare/hook.py", line 82, in _get_zone_id
r.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.cloudflare.com/client/v4/zones?name=space
The fix for this is to do this.
Change https://github.com/kappataumu/letsencrypt-cloudflare-hook/blob/master/hook.py#L21
To: import tld
And change: https://github.com/kappataumu/letsencrypt-cloudflare-hook/blob/master/hook.py#L79
To: tld = tld.get_fld('http://' + domain)
FYI: this repo is abandoned by its owner, but there is a maintained fork that does not have the mentioned issue:: https://github.com/SeattleDevs/letsencrypt-cloudflare-hook . Feel free to open an issue in that repo if you find a problem.
I have this same problem with https://github.com/walcony/letsencrypt-cloudflare-hook, and issues are not enabled on that repo!
I enabled Github Issues on that repo, can you create an issue there? https://github.com/SeattleDevs/letsencrypt-cloudflare-hook/issues/new/choose
Thanks @YasharF for that! It is working fine for me without any changes (just swapped old version with yours).