geoip2-tools
Automatic updates and administration of MaxMind GeoIP2 databases.
To install geoip2-tools, run this command in your terminal:
$ pip install geoip2-tools
This is the preferred method to install geoip2-tools, as it will always install the most recent stable release.
Usage
To use this library you must first obtain a license from Maxmind. It is free for the geolite2 version of the database.
In the menu on the left, navigate to Services > My License Key.
Click Generate new license key.
Save your license key in a secure site.
geoip2-tools downloads the latest version of the database and keeps it updated for you. By default every 7 days it is downloaded from the Maxmind servers.
from geoip2_tools.manager import Geoip2DataBaseManager
geoip2_manager = Geoip2DataBaseManager('<license key>')
print(geoip2_manager['country'].reader.country('1.1.1.1').country.name) # Australia
Geoip2-tools has aliases for the city, country, and asn Geolite2 databases. The country database is smaller than city. The city database also contains the countries:
city = geoip2_manager['country'].reader.city('<ip address>')
print(city.city.name)
print(city.country.name)
To obtain the ASN you must use the asn database:
asn = geoip2_manager['country'].reader.asn('<ip address>')
print(asn.autonomous_system_number)
print(asn.autonomous_system_organization)
Metadata
Release files for geoip2-tools 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geoip2-tools-0.1.1.tar.gz | 17.2 kB | Without provenance | Details for geoip2-tools-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geoip2_tools-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for geoip2_tools-0.1.1-py2.py3-none-any.whl |
Total release size: 24.6 kB
Release files / geoip2-tools-0.1.1.tar.gz
| Download URL | geoip2-tools-0.1.1.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b306da6de137018deac33e954dbd1388b15cba3639fa46a63a8c36e4f789f99
|
|
BLAKE2b-256 checksum How to use checksums |
a6e50f833c57d1d1bc3074416060b479705695d2fd4c34349fc2c6f8e987268c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Release files / geoip2_tools-0.1.1-py2.py3-none-any.whl
| Download URL | geoip2_tools-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ea093b76d7d90fcc890adaccdf35ad277724b79ac87f26e820ee5ac18ef65627
|
|
BLAKE2b-256 checksum How to use checksums |
c8d5c758409173e12acb672a44717dcee0ea108d4bfb9e3bf9f079614198751a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Security for geoip2-tools 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.