Convert ip addresses to a country using ip2nation db in memory.
Project description
===========
Geo IP
===========
Note: This is a friendly Python 3 port of [python-geo-ip](https://github.com/avindak/python-geo-ip) by Avi Asher. We look forward to the original package supporting Python 3.
Provides a fast, seamless in memory ip to country functionality based on the ip2nation db.
- No dependencies
- Completely free
- Country resolution only
- Queries / sec > 13.5k per core
- Data file can be refreshed without a restart
- Memory footprint < 40 MB
- Command line
- Stream / pipe ips and get comma delimited [ip,2 letter country code] e.g. 12.12.12.12,US
```python
from geoip import geoip
r = geoip.GeoIp()
r.load_memory()
r.resolve("12.12.12.12").country_code
#This prints : 'US'
print r.resolve("123.44.57.4")
#This prints : {'country': 'Korea (South)', 'host_name': '', 'country_code': 'KR'}
r.resolve2("133.12.12.12")
#This prints : 'JP'
```
# Command line
usage: geoip.py [-h][-v] {download,resolve} ...
positional arguments:
{download,resolve}
optional arguments:
-h, --help show this help message and exit
-v, --verbose increase output verbosity
usage: geoip.py resolve [-h][-ho] [-s][--stream] ip
positional arguments:
ip The ip address to get the country for
optional arguments:
-h, --help show this help message and exit
-ho, --host When set to true the code will try to get the host name
-s, --short When set to true the code will return a 2 letter country code
only
--stream When set to true the code expect a stream of ips
usage: geoip.py download [-h]
optional arguments:
-h, --help show this help message and exit
# Installation
pip install geoip2nation
PyPI: https://pypi-hypernode.com/pypi/geoip2nation/
Github: https://github.com/avindak/python-geo-ip
# ip2nation
- Data can be downloaded using the download method
- The load_memory method loads the ip2nation sql data file from disk into an in memory sqlite3 db
# license
MIT
# Links
- ip2nation home: http://ip2nation.com/
- ip2nation data file: http://www.ip2nation.com/ip2nation.zip
Geo IP
===========
Note: This is a friendly Python 3 port of [python-geo-ip](https://github.com/avindak/python-geo-ip) by Avi Asher. We look forward to the original package supporting Python 3.
Provides a fast, seamless in memory ip to country functionality based on the ip2nation db.
- No dependencies
- Completely free
- Country resolution only
- Queries / sec > 13.5k per core
- Data file can be refreshed without a restart
- Memory footprint < 40 MB
- Command line
- Stream / pipe ips and get comma delimited [ip,2 letter country code] e.g. 12.12.12.12,US
```python
from geoip import geoip
r = geoip.GeoIp()
r.load_memory()
r.resolve("12.12.12.12").country_code
#This prints : 'US'
print r.resolve("123.44.57.4")
#This prints : {'country': 'Korea (South)', 'host_name': '', 'country_code': 'KR'}
r.resolve2("133.12.12.12")
#This prints : 'JP'
```
# Command line
usage: geoip.py [-h][-v] {download,resolve} ...
positional arguments:
{download,resolve}
optional arguments:
-h, --help show this help message and exit
-v, --verbose increase output verbosity
usage: geoip.py resolve [-h][-ho] [-s][--stream] ip
positional arguments:
ip The ip address to get the country for
optional arguments:
-h, --help show this help message and exit
-ho, --host When set to true the code will try to get the host name
-s, --short When set to true the code will return a 2 letter country code
only
--stream When set to true the code expect a stream of ips
usage: geoip.py download [-h]
optional arguments:
-h, --help show this help message and exit
# Installation
pip install geoip2nation
PyPI: https://pypi-hypernode.com/pypi/geoip2nation/
Github: https://github.com/avindak/python-geo-ip
# ip2nation
- Data can be downloaded using the download method
- The load_memory method loads the ip2nation sql data file from disk into an in memory sqlite3 db
# license
MIT
# Links
- ip2nation home: http://ip2nation.com/
- ip2nation data file: http://www.ip2nation.com/ip2nation.zip
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
geoip2nation3-0.2.0.tar.gz
(364.5 kB
view details)
Built Distribution
geoip2nation3-0.2.0-py3-none-any.whl
(363.9 kB
view details)
File details
Details for the file geoip2nation3-0.2.0.tar.gz
.
File metadata
- Download URL: geoip2nation3-0.2.0.tar.gz
- Upload date:
- Size: 364.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 797a7b9ab3885099b6794f7ebef8bc0f0901a2ecb9613c7108d23153005ab2c3 |
|
MD5 | 898ed81441a42c9932a31d5ca1348a01 |
|
BLAKE2b-256 | ca58454e551f64a0f12d7028e417d483cee89c6067055550d10cdf9e9f54acf5 |
Provenance
File details
Details for the file geoip2nation3-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: geoip2nation3-0.2.0-py3-none-any.whl
- Upload date:
- Size: 363.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28641cdba416c733d4f0ffad51608640663f0f5bb087158065098f48e1939618 |
|
MD5 | 86d5aefce23a4a48ce59ddf47c6d3a29 |
|
BLAKE2b-256 | cf18264f15db8aed60589cae2e8007c9b6b8df10f411bdb4fccf0b166c3fabc7 |