2015-07-30 05:21:03 +08:00
|
|
|
def City(response):
|
|
|
|
return {
|
|
|
|
'city': response.city.name,
|
2017-10-25 16:30:42 +08:00
|
|
|
'continent_code': response.continent.code,
|
|
|
|
'continent_name': response.continent.name,
|
2015-07-30 05:21:03 +08:00
|
|
|
'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,
|
2017-11-30 00:54:34 +08:00
|
|
|
'region': response.subdivisions[0].iso_code if response.subdivisions else None,
|
2017-05-23 09:07:14 +08:00
|
|
|
'time_zone': response.location.time_zone,
|
2015-07-30 05:21:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def Country(response):
|
|
|
|
return {
|
|
|
|
'country_code': response.country.iso_code,
|
|
|
|
'country_name': response.country.name,
|
|
|
|
}
|