Fixed #35092 -- Exposed extra fields for GeoIP2.country() and GeoIP2.city() responses.

This commit is contained in:
Nick Pope 2024-01-10 11:09:44 +00:00 committed by GitHub
parent 9b02ad91ea
commit f50184a84b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 17 deletions

View file

@ -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")