Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyipip, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pyipip-0.1.1-py2.py3-none-any.whl (5.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pyipip-0.1.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page