Commit Graph

56 Commits

Author SHA1 Message Date
e8cc9adc7f Rework geoip to include ccode, lat, long for cache purposes 2020-11-15 10:57:53 -06:00
88cd84b5d2 Rework ipinfo to include ccode, lat, long for cache purposes 2020-11-15 10:57:22 -06:00
b7517bce65 Rework ip2location to include ccode, lat, long for cache purposes 2020-11-15 10:56:43 -06:00
66802657a5 Add COUNTRY_MAP dict for workaround function cleanliness 2020-11-15 10:54:51 -06:00
117727bc2b Add pycountry dependency for converting ISO code to country name 2020-11-15 10:53:59 -06:00
bd7dd05cca Observe region in geolocator 2020-11-01 20:04:14 -06:00
afde91211c Check and observe region and country in building formatted location 2020-11-01 17:00:09 -06:00
deb2a5d01f Adjust ipcache to observe new region
THIS WILL INVALIDATE THE EXISTING CACHE!
The new cache now pulls data from all three of geoip, ip2location, and
ipinfo, and stores it in the relatively simple city;region;country
format.

The old format would either store city;country or store
countrycode;country;region;city directly from ip2location, so it is much
more consistent with this change.
2020-11-01 16:37:45 -06:00
2ebdb15398 Adjust ipcachewrite to account for region addition 2020-11-01 16:37:26 -06:00
c7d3b32d53 Remove cache operation from ip2location; shortcut where possible
This comes with something of a refactor.

- IP2LOCATION_KEY is now checked with `if not` to reduce indention
- ConnectionError is increased to RequestException to catch all requests
  errors
  - On that note, now raising for status too
2020-11-01 16:35:17 -06:00
628a860d6d Remove cache operation from ipinfo; shortcut where possible
This comes with something of a refactor.

- IPINFO_TOKEN is now checked with `if not` to reduce indention
- ConnectionError is increased to RequestException to catch all requests
  errors
  - On that note, now raising for status too
- Now catching ValueError in case of json parsing failure
2020-11-01 16:32:13 -06:00
996485adf1 Remove cache operation from geoip; shortcut where possible 2020-11-01 16:31:46 -06:00
e4ac3f266f Do cache read and write in get_location instead of duplicated in each IPLOCATION_ORDER method 2020-11-01 16:31:15 -06:00
7af4aaa8ec Correct docstring for get_location 2020-11-01 16:30:00 -06:00
e1adca3bf0 Add region into location formatting 2020-11-01 16:28:24 -06:00
f3bce5f806 Unpack region from get_location call or fail case 2020-11-01 16:27:40 -06:00
4fa1ebd995 Add location[2] to ipcachewrite for new region part of cache 2020-11-01 15:03:14 -06:00
08be8787b1 Observe new region var in get_location 2020-11-01 13:50:05 -06:00
c65614d230 Enable ipcache writes from geoip lookup 2020-11-01 13:45:32 -06:00
ef477822ae Coalesce location into 3-tuple in geoip lookup 2020-11-01 13:45:08 -06:00
4996c5a553 Pass region through workaround for consistency 2020-11-01 13:42:31 -06:00
511b13bdcb Capture and return region from ipinfo lookup 2020-11-01 13:41:52 -06:00
35a35a56e2 Capture region from ip2location lookup 2020-11-01 13:40:20 -06:00
af9658f63b Check ipcache before fetching from geoip 2020-11-01 13:19:45 -06:00
0056a97386 Capture and return region from geoip lookup 2020-11-01 13:05:03 -06:00
79eea95904 moonphase depends on the hemishphere (#247) 2020-09-20 11:09:57 +02:00
a62e3d979d fxed a regression (geolocation cache) 2020-09-20 11:09:04 +02:00
3c16ac7993 support for ipinfo and ip to location ordering 2020-07-27 17:25:44 -07:00
cecde8fec8 fixed location for localhost 2020-04-27 20:40:13 +02:00
ac1be8305b lib/location.py: python3 fixes 2020-04-03 20:58:51 +02:00
e5ab61dea3 added workaround for python3 (#369) 2020-02-12 21:44:56 +01:00
e78e6e6f22 fixed lower case problem 2019-09-07 15:06:40 +02:00
0f4dbd2e09 always force the ~query form 2019-08-25 20:39:22 +02:00
ef50b23f5b fixes for the @echarlie IPv6 patch (#160) 2019-07-07 19:10:05 +02:00
040b9ea7d7 various png-related problems fixed (#311) 2019-07-07 18:39:53 +02:00
e1930bedfb lib/location.py: location can be None (#296) 2019-05-15 17:57:01 +02:00
8142e30e53 how to configure ip2location (#296) 2019-05-09 17:40:22 +02:00
f8e7aef267 typos fixed (fixes #267) 2019-02-04 12:12:02 +01:00
65855a6d6a displayed location names for implied locations fixes (fixes #265) 2019-02-01 23:32:17 +01:00
067be9c319 specify country resolving location found by geolocation (fixes #264; related to #167) 2019-02-01 12:04:26 +01:00
0f6d8da10c do not add country name to the GPS coords (fixes #260) 2019-01-11 17:27:14 +01:00
b75f991b30 do full location resolution when location is not specified (experimental) 2019-01-11 10:58:08 +01:00
26ed9fa28b Merge branch 'master' of https://github.com/chubin/wttr.in 2018-12-09 19:39:22 +01:00
4730dce9a4 ip2location related minor fixes 2018-12-09 19:39:20 +01:00
7c47cd7d0c Modernize Python 2 code to get ready for Python 3 2018-12-02 09:41:29 +01:00
a45855fbb4 geolocation related fixes 2018-11-02 18:12:53 +01:00
e6687abf13 use USCS for US-based IPs (fixes #229 #162) 2018-10-27 17:14:33 +02:00
c558824fbf rewrite country name (in some cases) 2018-10-27 00:58:42 +02:00
dbb8aab676 for IPs covered by GeoIP2, use country name instead of ISO Code (fixes #209) 2018-10-27 00:54:05 +02:00
2844a94c88 several minor geolocation bugs fixed (fixes #63, #135, #162, #209) 2018-10-27 00:19:22 +02:00