Exception: Unable to automatically obtain IP address from http://ipv4.icanhazip.com/.
Opened this issue · 3 comments
Hello,
a couple of days ago the script started not working for me:
/usr/local/sbin/godaddy_ddns.py --key
`Traceback (most recent call last):
File "/usr/local/sbin/godaddy_ddns.py", line 92, in main
with urlopen("https://ipv4.icanhazip.com/") as f: resp=f.read()
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.7/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/sbin/godaddy_ddns.py", line 162, in
main()
File "/usr/local/sbin/godaddy_ddns.py", line 97, in main
raise Exception(msg)
**Exception: Unable to automatically obtain IP address from http://ipv4.icanhazip.com/.**`
But if I run it from command line, I can get the ip address::
root@localhost:~# curl http://ipv4.icanhazip.com/
the detailed log:
root@localhost:~# curl -i http://ipv4.icanhazip.com/
`HTTP/1.1 200 OK
Date: Mon, 01 Mar 2021 10:11:22 GMT
Content-Type: text/plain
Content-Length: 12
Connection: keep-alive
Set-Cookie: __cfduid=d6dd09ce480956bb6847e99eda9053e401614593482; expires=Wed, 31-Mar-21 10:11:22 GMT; path=/; domain=.ipv4.icanhazip.com; HttpOnly; SameSite=Lax
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET
X-RTFM: Learn about this site at http://bit.ly/icanhazip-faq
X-THANK-YOU: Many thanks to the fine people at Cloudflare for keeping this site afloat!
cf-request-id: 088ede764800004dbed22a0000000001
Report-To: {"group":"cf-nel","endpoints":[{"url":"https://a.nel.cloudflare.com/report?s=LPt2EctSaulVAG6Z6QgBWFTRMp9%2FW1rXNl%2F25DP2DOMkQTnIc5hhnLfm0OjEOnHBm8o0oARt4Fp8%2BDLt9%2FAizs6%2BZLPzUNCzFKfxPmPL3HScIho%3D"}],"max_age":604800}
NEL: {"max_age":604800,"report_to":"cf-nel"}
Server: cloudflare
CF-RAY: 629199d07f294dbe-FRA
Any idea, what can be the problem?
thanks!
im having the same issue
Hello,
Today I tried it, and solved the problem with replacing http://ipv4.icanhazip.com/ with https://checkip.amazonaws.com/ and it's working.
BR