Closed o355 closed 6 years ago
So here's the deal. There really is no good API that's free and has HTTPS support. Can't get everything free in life.
To make sure there is a geo ip system in PyWeather that supports API we will use ipstack for HTTPS requests and ip-api.com for HTTP requests. The user will be able to decide which API they want to use.
More info will come soon.
Upon further investigation, ipstack isn't fesible, and the free plan doesn't include SSL support.
ip-api.com it is
ip-api.com is being blocked by my Pi-Hole, and is found on many ad server lists. As such, we need to find a new Geo IP API.
Then again, freegeoip.net was also blocked by my Pi-Hole as well, and I had to manually whitelist it. However, I want to make sure that the API we're using isn't blocked by any firewalls.
If we can't find a new API by v1.0.0 the Geo IP feature may have to be dropped.
I have a content blocker on my computer, but this one seems to work: https://ipapi.co/
It has https, and there shouldn't be any issues with rate limits (unless someone checks their local weather 1000 times a day). It also seems to give latitude/longitude coordinates. Example query: curl 'https://ipapi.co/json/'
Output: { "ip": "8.8.8.8", "city": "Mountain View", "region": "California", "region_code": "CA", "country": "US", "country_name": "United States", "continent_code": "NA", "in_eu": false, "postal": "94035", "latitude": 37.386, "longitude": -122.0838, "timezone": "America/Los_Angeles", "utc_offset": "-0700", "country_calling_code": "+1", "currency": "USD", "languages": "en-US,es-US,haw,fr", "asn": "AS15169", "org": "Google LLC" }
Looking at your code, it looks like the 2 APIs are interchangeable without editing the parser
Alright that's good to hear.
Looks like we found a new Geo API, so I'm closing this issue for now.
Freegeoip.net is being depreciated on July 1st.
Time to find a new API!