ipip.net IP address geolocation database Python library
Project description
Description
ipip.net IPv4 地址归属地数据库 Python 查询库。同时支持 dat 与 datx 格式的数据文件,支持 Python 2 与 3。 需要先去 ipip.net 官方网站 下载数据文件。
性能较官方库为高,在 E5-2682 2.5GHz 下 QPS 约为 490k。
Usage
>>> from pyipip import IPIPDatabase
>>> db = IPIPDatabase('/path/to/your/ipipdb.dat')
>>> db.lookup('202.112.80.106')
'中国\t北京\t北京\t'
Install
pip install pyipip
Test & Benchmark
make test
make bench
Note
数据文件时时更新,请自行下载使用,代码仓库随附的数据文件只用于测试。
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
pyipip-0.1.1.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for pyipip-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c16c01f05da3c48352518074576e26221056497d4400236846c4e4dd205e871c |
|
MD5 | 104de85fe1f7bed605dd01992ee88985 |
|
BLAKE2b-256 | b568f5e3868c60c377468e31391ff2312244944dc21b53280cad3a082ffd1cc8 |