a geographic information database
Project description
XdbLocation
是一个离线IP地址定位库和IP定位数据管理的库
- PyPI package: https://pypi.org/project/xdb_location/
- Github: https://github.com/gunhe/xdb_location
安装
稳定版本
要安装Xdb_Location,请在终端中运行以下命令:
uv add xdb_location
或者,如果你更喜欢使用 pip:
pip install xdb_location
源码安装
Xdb_Location的源文件可以从以下网址下载 Github repo.
您可以克隆公共存储库:
git clone git://github.com/gunhe/xdb_location
一旦你有了源代码的副本,你就可以用以下方式安装它:
cd xdb_location
uv pip install .
使用
from xdb_location.xdb_location import searchWithContent
target_ip_location = searchWithContent(target_ip="1.15.241.228")
print(target_ip_location)
最佳实践
# 程序启动前把 searchWithContent 对象缓存下来,做成一个全局对象
from xdb_location.xdb_location import searchWithContentCache
# 使用searchWithContent 对象来查询
searcher = searchWithContentCache()
target_ip_location = searcher.search("1.15.241.228")
print(target_ip_location)
# 程序结束时候释放内存空间
searcher.close()
数据生成
git clone https://github.com/gunhe/xdb_location.git
cd xdb_location
# 测试数据生成
uv run xdb_location ./src/xdb_location/data/ip.test.txt ./ip2region.test.xdb
# ipv4 数据生成
uv run xdb_location ./src/xdb_location/data/ipv4_source.txt ./ip2region.ipv4_source.xdb
# ipv6 数据生成
uv run xdb_location ./src/xdb_location/data/ipv6_source.txt ./ip2region.ipv6_source.xdb
参考
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
xdb_location-0.1.8.tar.gz
(32.8 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xdb_location-0.1.8.tar.gz.
File metadata
- Download URL: xdb_location-0.1.8.tar.gz
- Upload date:
- Size: 32.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b39930a6012f7f1ae31126feae677388973d2a7b882edef155eff2cf86768d66
|
|
| MD5 |
cca5252d3496a8de74d68de644d80041
|
|
| BLAKE2b-256 |
f8328f156cb5c413c5a03c7895d226426335b49b6558edecf1cb52d02057ed64
|
File details
Details for the file xdb_location-0.1.8-py3-none-any.whl.
File metadata
- Download URL: xdb_location-0.1.8-py3-none-any.whl
- Upload date:
- Size: 32.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e864984047dc586407896e4ee09407ba8b21db4e8a5d0ccdf1a0ac85548b2ef3
|
|
| MD5 |
63f597ead94ccd5eba6e8bc028955983
|
|
| BLAKE2b-256 |
07c3acd107ffb31db692219cca51d7efa712d350921ac1884cc0ffd2d6712052
|