Python code for GeoIP2 webservice client and database reader
geoip.webservice.AsyncClient
.geoip.webservice.Client
now provides a close()
method and associated
context managers to be used in with
statements.postal_code
and postal_confidence
have been removed
from geoip2.record.Location
. These would previously always be None
.user_id
is no longer supported as a named argument for the constructor
on geoip2.webservice.Client
. Use account_id
or a positional
parameter instead.Client
and AsyncClient
requests, the default timeout is
now 60 seconds.geoip2.record.*
classes have been refactored to
improve performance. This refactoring may break classes that inherit from
them. The public API should otherwise be compatible.network
attribute was added to geoip2.record.Traits
,
geoip2.model.AnonymousIP
, geoip2.model.ASN
,
geoip2.model.ConnectionType
, geoip2.model.Domain
,
and geoip2.model.ISP
. This is an ipaddress.IPv4Network
or an
ipaddress.IPv6Network
. This is the largest network where all of the
fields besides ip_address
have the same value. GitHub #79.is_anonymous_vpn
and
is_hosting_provider
- to be more descriptive.user_count
trait for the GeoIP2 Precision webservice.static_ip_score
attribute to geoip2.record.Traits
for
GeoIP2 Precision Insights. This is a float which indicates how static or dynamic
an IP address is.geoip2.database.Reader
object using MODE_FD
.
This will read the database from the file descriptor into memory. Pull
request by nkinkade. GitHub #53.ACCOUNT_ID_REQUIRED
AND ACCOUNT_ID_UNKNOWN
error codes.is_in_european_union
attribute was added to
geoip2.record.Country
and geoip2.record.RepresentedCountry
. This
attribute is True
if the country is a member state of the European
Union.geoip2.record.Traits
for use with GeoIP2 Precision Insights: is_anonymous
,
is_anonymous_vpn
, is_hosting_provider
, is_public_proxy
, and
is_tor_exit_node
.requests
(2.12.2 and 2.12.3) require that the
username for basic authentication be a string or bytes. The documentation
for this module uses an integer for the user_id
, which will break with
these requests
versions. The user_id
is now converted to bytes
before being passed to requests
.setup.py
.ipaddress
on Python 2 rather than ipaddr
to
validate IP addresses before sending them to the web service.