This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
mochaserverpine64backup/lib/python3.6/site-packages/django/contrib/gis/geoip2/resources.py
2018-04-06 01:18:25 -05:00

19 lines
651 B
Python

def City(response):
return {
'city': response.city.name,
'country_code': response.country.iso_code,
'country_name': response.country.name,
'dma_code': response.location.metro_code,
'latitude': response.location.latitude,
'longitude': response.location.longitude,
'postal_code': response.postal.code,
'region': response.subdivisions[0].iso_code if len(response.subdivisions) else None,
'time_zone': response.location.time_zone,
}
def Country(response):
return {
'country_code': response.country.iso_code,
'country_name': response.country.name,
}