You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
601 B

  1. def City(response):
  2. return {
  3. 'city': response.city.name,
  4. 'country_code': response.country.iso_code,
  5. 'country_name': response.country.name,
  6. 'dma_code': response.location.metro_code,
  7. 'latitude': response.location.latitude,
  8. 'longitude': response.location.longitude,
  9. 'postal_code': response.postal.code,
  10. 'region': response.subdivisions[0].iso_code if len(response.subdivisions) else None,
  11. }
  12. def Country(response):
  13. return {
  14. 'country_code': response.country.iso_code,
  15. 'country_name': response.country.name,
  16. }