Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

hemamaps / Django   python

Repository URL to install this package:

Version: 1.9.8 

/ contrib / gis / geoip2 / resources.py

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,
    }


def Country(response):
    return {
        'country_code': response.country.iso_code,
        'country_name': response.country.name,
    }