mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #35092 -- Exposed extra fields for GeoIP2.country() and GeoIP2.city() responses.
This commit is contained in:
parent
9b02ad91ea
commit
f50184a84b
4 changed files with 52 additions and 17 deletions
|
@ -33,20 +33,28 @@ Here is an example of its usage:
|
|||
>>> from django.contrib.gis.geoip2 import GeoIP2
|
||||
>>> g = GeoIP2()
|
||||
>>> g.country("google.com")
|
||||
{'country_code': 'US', 'country_name': 'United States'}
|
||||
{'continent_code': 'NA',
|
||||
'continent_name': 'North America',
|
||||
'country_code': 'US',
|
||||
'country_name': 'United States',
|
||||
'is_in_european_union': False}
|
||||
>>> g.city("72.14.207.99")
|
||||
{'city': 'Mountain View',
|
||||
'continent_code': 'NA',
|
||||
'continent_name': 'North America',
|
||||
'country_code': 'US',
|
||||
'country_name': 'United States',
|
||||
'dma_code': 807,
|
||||
'is_in_european_union': False,
|
||||
'latitude': 37.419200897216797,
|
||||
'longitude': -122.05740356445312,
|
||||
'postal_code': '94043',
|
||||
'region': 'CA',
|
||||
'time_zone': 'America/Los_Angeles'}
|
||||
{'accuracy_radius': 1000,
|
||||
'city': 'Mountain View',
|
||||
'continent_code': 'NA',
|
||||
'continent_name': 'North America',
|
||||
'country_code': 'US',
|
||||
'country_name': 'United States',
|
||||
'is_in_european_union': False,
|
||||
'latitude': 37.419200897216797,
|
||||
'longitude': -122.05740356445312,
|
||||
'metro_code': 807,
|
||||
'postal_code': '94043',
|
||||
'region_code': 'CA',
|
||||
'region_name': 'California',
|
||||
'time_zone': 'America/Los_Angeles',
|
||||
'dma_code': 807,
|
||||
'region': 'CA'}
|
||||
>>> g.lat_lon("salon.com")
|
||||
(39.0437, -77.4875)
|
||||
>>> g.lon_lat("uh.edu")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue