Skip to main content

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


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)

Uploaded Source

Built Distribution

pyipip-0.1.1-py2.py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page