letsencrypt-cloudflare-hook icon indicating copy to clipboard operation
letsencrypt-cloudflare-hook copied to clipboard

HTTPError: 400 Client Error: Bad Request for url: https://api.cloudflare.com/client/v4/zones

Open uzzal2k5 opened this issue 6 years ago • 5 comments

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

uzzal2k5 avatar Oct 23 '19 16:10 uzzal2k5

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)

JohnVillalovos avatar Nov 16 '19 17:11 JohnVillalovos

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.

YasharF avatar Mar 10 '20 15:03 YasharF

I have this same problem with https://github.com/walcony/letsencrypt-cloudflare-hook, and issues are not enabled on that repo!

moose999 avatar Apr 01 '20 16:04 moose999

I enabled Github Issues on that repo, can you create an issue there? https://github.com/SeattleDevs/letsencrypt-cloudflare-hook/issues/new/choose

YasharF avatar Apr 01 '20 17:04 YasharF

Thanks @YasharF for that! It is working fine for me without any changes (just swapped old version with yours).

prashnts avatar Jun 04 '20 12:06 prashnts