Commit graph

70 commits

Author SHA1 Message Date
Igor Chubin
fe39b77813 Log ip resolution queries 2021-01-21 23:12:40 +01:00
Igor Chubin
a6d0adbbf7 Fix _geoip() format bug 2021-01-21 23:12:06 +01:00
Igor Chubin
ed569540bc Canonify contries names 2021-01-02 17:32:06 +01:00
Igor Chubin
e525129847 Move broken entries to a separate dir 2021-01-02 13:58:28 +01:00
Igor Chubin
3c8149a227 Cleanup 2021-01-02 12:45:17 +01:00
Gregory Danielson
e98fbe9258
Document expected ipcachewrite input and output, with optional latlong entries 2020-11-26 12:21:22 -06:00
Gregory Danielson
c49c0a5c0e
Remove lat, long from _ip2location because WS5 is more expensive 2020-11-26 12:20:35 -06:00
Igor Chubin
1b25e16a37 Minor code cleanup 2020-11-16 19:52:10 +01:00
Igor Chubin
41d4d3d789 Extend location.py docstring 2020-11-16 19:51:51 +01:00
Gregory Danielson
26372148b5
Merge branch 'master' of github.com:chubin/wttr.in 2020-11-15 11:24:46 -06:00
Gregory Danielson
bdcb24742d
Rework ipcache write to include new data from all sources 2020-11-15 11:10:19 -06:00
Gregory Danielson
c349dc2f17
Break from IPLOCATION method loop if one method produces non-null result 2020-11-15 11:02:12 -06:00
Gregory Danielson
34313eb162
Rework get_location to handle additions to location tuple; same return 2020-11-15 10:58:51 -06:00
Gregory Danielson
e8cc9adc7f
Rework geoip to include ccode, lat, long for cache purposes 2020-11-15 10:57:53 -06:00
Gregory Danielson
88cd84b5d2
Rework ipinfo to include ccode, lat, long for cache purposes 2020-11-15 10:57:22 -06:00
Gregory Danielson
b7517bce65
Rework ip2location to include ccode, lat, long for cache purposes 2020-11-15 10:56:43 -06:00
Gregory Danielson
66802657a5
Add COUNTRY_MAP dict for workaround function cleanliness 2020-11-15 10:54:51 -06:00
Gregory Danielson
117727bc2b
Add pycountry dependency for converting ISO code to country name 2020-11-15 10:53:59 -06:00
Igor Chubin
626a106186 Fix bug with location format 2020-11-07 19:57:39 +01:00
Gregory Danielson
bd7dd05cca
Observe region in geolocator 2020-11-01 20:04:14 -06:00
Gregory Danielson
afde91211c
Check and observe region and country in building formatted location 2020-11-01 17:00:09 -06:00
Gregory Danielson
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
Gregory Danielson
2ebdb15398
Adjust ipcachewrite to account for region addition 2020-11-01 16:37:26 -06:00
Gregory Danielson
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
Gregory Danielson
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
Gregory Danielson
996485adf1
Remove cache operation from geoip; shortcut where possible 2020-11-01 16:31:46 -06:00
Gregory Danielson
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
Gregory Danielson
7af4aaa8ec
Correct docstring for get_location 2020-11-01 16:30:00 -06:00
Gregory Danielson
e1adca3bf0
Add region into location formatting 2020-11-01 16:28:24 -06:00
Gregory Danielson
f3bce5f806
Unpack region from get_location call or fail case 2020-11-01 16:27:40 -06:00
Gregory Danielson
4fa1ebd995
Add location[2] to ipcachewrite for new region part of cache 2020-11-01 15:03:14 -06:00
Gregory Danielson
08be8787b1
Observe new region var in get_location 2020-11-01 13:50:05 -06:00
Gregory Danielson
c65614d230
Enable ipcache writes from geoip lookup 2020-11-01 13:45:32 -06:00
Gregory Danielson
ef477822ae
Coalesce location into 3-tuple in geoip lookup 2020-11-01 13:45:08 -06:00
Gregory Danielson
4996c5a553
Pass region through workaround for consistency 2020-11-01 13:42:31 -06:00
Gregory Danielson
511b13bdcb
Capture and return region from ipinfo lookup 2020-11-01 13:41:52 -06:00
Gregory Danielson
35a35a56e2
Capture region from ip2location lookup 2020-11-01 13:40:20 -06:00
Gregory Danielson
af9658f63b
Check ipcache before fetching from geoip 2020-11-01 13:19:45 -06:00
Gregory Danielson
0056a97386
Capture and return region from geoip lookup 2020-11-01 13:05:03 -06:00
Igor Chubin
79eea95904 moonphase depends on the hemishphere (#247) 2020-09-20 11:09:57 +02:00
Igor Chubin
a62e3d979d fxed a regression (geolocation cache) 2020-09-20 11:09:04 +02:00
Emil Lerch
3c16ac7993
support for ipinfo and ip to location ordering 2020-07-27 17:25:44 -07:00
Igor Chubin
cecde8fec8 fixed location for localhost 2020-04-27 20:40:13 +02:00
Igor Chubin
ac1be8305b lib/location.py: python3 fixes 2020-04-03 20:58:51 +02:00
Igor Chubin
e5ab61dea3 added workaround for python3 (#369) 2020-02-12 21:44:56 +01:00
Igor Chubin
e78e6e6f22 fixed lower case problem 2019-09-07 15:06:40 +02:00
Igor Chubin
0f4dbd2e09 always force the ~query form 2019-08-25 20:39:22 +02:00
Igor Chubin
ef50b23f5b fixes for the @echarlie IPv6 patch (#160) 2019-07-07 19:10:05 +02:00
Igor Chubin
040b9ea7d7 various png-related problems fixed (#311) 2019-07-07 18:39:53 +02:00
Igor Chubin
e1930bedfb lib/location.py: location can be None (#296) 2019-05-15 17:57:01 +02:00