Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
postal_code=None,
postal_confidence=None,
time_zone=None,
**_):
self.average_income = average_income
self.accuracy_radius = accuracy_radius
self.latitude = latitude
self.longitude = longitude
self.metro_code = metro_code
self.population_density = population_density
self.postal_code = postal_code
self.postal_confidence = postal_confidence
self.time_zone = time_zone
class MaxMind(Record):
"""Contains data related to your MaxMind account.
Attributes:
.. attribute:: queries_remaining
The number of remaining queries you have
for the end point you are calling.
:type: int
"""
def __init__(self, queries_remaining=None, **_):
self.queries_remaining = queries_remaining
class Record(SimpleEquality):
"""All records are subclasses of the abstract class ``Record``."""
__metaclass__ = ABCMeta
def __repr__(self):
args = ', '.join('%s=%r' % x for x in self.__dict__.items())
return '{module}.{class_name}({data})'.format(
module=self.__module__,
class_name=self.__class__.__name__,
data=args)
class PlaceRecord(Record):
"""All records with :py:attr:`names` subclass :py:class:`PlaceRecord`."""
__metaclass__ = ABCMeta
def __init__(self, locales=None, names=None):
if locales is None:
locales = ['en']
self._locales = locales
if names is None:
names = {}
self.names = names
@property
def name(self):
"""Dict with locale codes as keys and localized name as value."""
# pylint:disable=E1101
Attributes:
.. attribute:: queries_remaining
The number of remaining queries you have
for the end point you are calling.
:type: int
"""
def __init__(self, queries_remaining=None, **_):
self.queries_remaining = queries_remaining
class Postal(Record):
"""Contains data for the postal record associated with an IP address.
This class contains the postal data associated with an IP address.
This attribute is returned by ``city``, ``enterprise``, and ``insights``.
Attributes:
.. attribute:: code
The postal code of the location. Postal
codes are not available for all countries. In some countries, this will
only contain part of the postal code.
:type: unicode
locales=None,
confidence=None,
geoname_id=None,
is_in_european_union=False,
iso_code=None,
names=None,
# pylint:disable=redefined-builtin
type=None,
**_):
self.type = type
super(RepresentedCountry,
self).__init__(locales, confidence, geoname_id,
is_in_european_union, iso_code, names)
class Location(Record):
"""Contains data for the location record associated with an IP address.
This class contains the location data associated with an IP address.
This record is returned by ``city``, ``enterprise``, and ``insights``.
Attributes:
.. attribute:: average_income
The average income in US dollars associated with the requested IP
address. This attribute is only available from the Insights end point.
:type: int
.. attribute:: accuracy_radius
@property
def most_specific(self):
"""The most specific (smallest) subdivision available.
If there are no :py:class:`Subdivision` objects for the response,
this returns an empty :py:class:`Subdivision`.
:type: :py:class:`Subdivision`
"""
try:
return self[-1]
except IndexError:
return Subdivision(self._locales)
class Traits(Record):
"""Contains data for the traits record associated with an IP address.
This class contains the traits data associated with an IP address.
This class has the following attributes:
.. attribute:: autonomous_system_number
The `autonomous system
number `_
associated with the IP address. This attribute is only available from
the City and Insights web service end points and the GeoIP2 Enterprise
database.
:type: int