Lookup location of IP in qqwry.dat, for Python 3.0+
Project description
用于在qqwry.dat里查找IP地址归属地,另提供一个从纯真网络更新qqwry.dat的小工具。
已上传到PyPI,执行此命令即可安装:pip install qqwry-py3
特点
for Python 3.0+。
提供两套实现供选择。有一个查找速度更快,但加载慢、占用内存多。
在i3 3.6GHz,Python 3.6上查询速度达18.0万次/秒。
提供一个从纯真网络(cz88.net)更新qqwry.dat的小工具,用法见本文最后一部分。
用法
>>> from qqwry import QQwry >>> q = QQwry() >>> q.load_file('qqwry.dat') >>> q.lookup('8.8.8.8') ('美国', '加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器')
解释q.load_file(filename, loadindex=False)函数
解释q.lookup(‘8.8.8.8’)函数
解释q.clear()函数
解释q.is_loaded()函数
q对象是否已加载数据,返回True或False
解释q.get_lastone()函数
>>> q.get_lastone() ('纯真网络', '2020年9月30日IP数据')
从纯真网络(cz88.net)更新qqwry.dat的小工具
>>> from qqwry import updateQQwry >>> ret = updateQQwry(filename)
Features
for Python 3.0+.
Provide two sets of implementations for selection. One finds faster, but loads slowly and takes up more memory.
The query speed on i3 3.6GHz and Python 3.6 is 180,000 times per second.
Provide a small tool to update qqwry.dat from Chunzhen Network (cz88.net), see the last part of this article for usage.
usage
>>> from qqwry import QQwry >>> q = QQwry() >>> q.load_file('qqwry.dat') >>> q.lookup('8.8.8.8') ('United States','Google DNS server in Mountain View, Santa Clara County, California')
Explain the q.load_file(filename, loadindex=False) function
Explain the q.lookup(‘8.8.8.8’) function
Explain the q.clear() function
Explain the q.is_loaded() function
Whether the q object has loaded data, return True or False
Explain the q.get_lastone() function
>>> q.get_lastone() ('纯真网络', '2020年9月30日IP数据')
Update the widget of qqwry.dat from Chunzhen Network (cz88.net)
>>> from qqwry import updateQQwry >>> ret = updateQQwry(filename)
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
File details
Details for the file qqwry-py3-1.2.1.tar.gz
.
File metadata
- Download URL: qqwry-py3-1.2.1.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 805060289974c8830c548da5b35030686943ce2054438457b20379a804e41dca |
|
MD5 | 0e3ddc881ea5e0c2723a819c0cba1d04 |
|
BLAKE2b-256 | af616c5ed0a589cc76cd8ac3ced4f90742c8fc8e6baffc4600c08cc6c47b5339 |