How to use the geoip2.records.Subdivisions function in geoip2

To help you get started, we’ve selected a few geoip2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github m-lab / mlab-ns / server / mlabns / third_party / geoip2 / geoip2 / models.py View on Github external
def __init__(self, raw_response, locales=None):
        super(City, self).__init__(raw_response, locales)
        self.city = \
            geoip2.records.City(locales, **raw_response.get('city', {}))
        self.location = \
            geoip2.records.Location(**raw_response.get('location', {}))
        self.postal = \
            geoip2.records.Postal(**raw_response.get('postal', {}))
        self.subdivisions = \
            geoip2.records.Subdivisions(locales,
                                        *raw_response.get('subdivisions', []))
github maxmind / GeoIP2-python / geoip2 / models.py View on Github external
def __init__(self, raw_response, locales=None):
        super(City, self).__init__(raw_response, locales)
        self.city = \
            geoip2.records.City(locales, **raw_response.get('city', {}))
        self.location = \
            geoip2.records.Location(**raw_response.get('location', {}))
        self.postal = \
            geoip2.records.Postal(**raw_response.get('postal', {}))
        self.subdivisions = \
            geoip2.records.Subdivisions(locales,
                                        *raw_response.get('subdivisions', []))
github maxmind / GeoIP2-python / geoip2 / records.py View on Github external
def __init__(self, locales, *subdivisions):  # pylint:disable=W0613
        self._locales = locales
        super(Subdivisions, self).__init__()
github maxmind / GeoIP2-python / geoip2 / records.py View on Github external
def __new__(cls, locales, *subdivisions):
        subdivisions = [Subdivision(locales, **x) for x in subdivisions]
        obj = super(cls, Subdivisions).__new__(cls, subdivisions)
        return obj