mirror of
https://github.com/chubin/wttr.in
synced 2025-01-26 10:45:01 +00:00
Extend location.py docstring
This commit is contained in:
parent
26372148b5
commit
41d4d3d789
1 changed files with 28 additions and 4 deletions
|
@ -1,11 +1,35 @@
|
||||||
"""
|
"""
|
||||||
All location related functions and converters.
|
All location related functions and converters.
|
||||||
|
|
||||||
The main entry point is `location_processing`
|
The main entry point is `location_processing` which gets `location` and
|
||||||
which gets `location` and `source_ip_address`
|
`source_ip_address` and basing on this information generates precise location
|
||||||
and basing on this information generates
|
description.
|
||||||
precise location description.
|
|
||||||
|
|
||||||
|
[query] --> [location] --> [(lat,long)] -->
|
||||||
|
^
|
||||||
|
|
|
||||||
|
[ip-address] --> _get_location()
|
||||||
|
|
||||||
|
To resolve IP address into location, the module uses function `_get_location()`,
|
||||||
|
which subsequenlty utilizes one of the three methods:
|
||||||
|
|
||||||
|
* `_geoip2()` (local sqlite database);
|
||||||
|
* `_ip2location()` (an external paid service);
|
||||||
|
* `_ipinfo()` (an external free service).
|
||||||
|
|
||||||
|
IP-address resolution data is saved in cache (_ipcachewrite, _ipcache).
|
||||||
|
Cache entry format:
|
||||||
|
|
||||||
|
COUNTRY_CODE;COUNTRY;REGION;CITY[;REST]
|
||||||
|
|
||||||
|
To resolve location name into a (lat,long) pair,
|
||||||
|
an external service is used, which is wrapped
|
||||||
|
with a function `_geolocator()`.
|
||||||
|
|
||||||
|
Exports:
|
||||||
|
|
||||||
|
location_processing
|
||||||
|
is_location_blocked
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue