Skip to main content

iputil

Provide some useful util functions and a tool (ip2region) for ip processing.

Install

pip3 install iputil

Python usage

import iputil

# Get Region by IP
iputil.get_region("60.30.1.1")
# return string '中国|0|天津|天津|联通'

Although region data in this program will update with the @ip2region repo, or your can specify your own data source:

import iputil

# Set Region source
iputil.set_region_source(data_file="ip2region.db")

# Get Region by IP
iputil.get_region("60.30.1.1")
# return string '中国|0|天津|天津|联通'

Tools

An independent tool named ip2region will be install in your path.

Typing ip2region will start a prompt:

$ ip2region
ip> 192.168.0.1
[192.168.0.1]   0|0|0|内网IP|内网IP

ip> 60.30.1.1
[60.30.1.1]     中国|0|天津|天津|联通

ip> 120.100.0.1
[120.100.0.1]   中国|0|台湾|台北|0

ip> 8.8.8.8
[8.8.8.8]       美国|0|0|0|谷歌

ip> 
$ ip2region -h
usage: ip2region [-h] [-ip IP]

IP to Region

optional arguments:
  -h, --help       show this help message and exit
  -ip IP, --ip IP  Search specify IP

Reflink

Thanks to @ip2region.

Metadata

Release files for iputil 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iputil 0.3.2
File Size Uploaded Provenance Actions
iputil-0.3.2.tar.gz 4.3 MB Without provenance Details for iputil-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iputil 0.3.2
File Interpreter ABI Platform Actions
iputil-0.3.2-py3-none-any.whl Python 3 none any Details for iputil-0.3.2-py3-none-any.whl

Total release size: 8.7 MB

Release files / iputil-0.3.2.tar.gz

Download URL iputil-0.3.2.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
d612fff35a225faaf4cf2b6f9ff87bb5dd7f082f24474fcc0ed5553f84adf0d5
BLAKE2b-256 checksum
How to use checksums
abec9ed91900c77af0a4ebf9f182bdfe5cd2fa27877e6bd386a7b9d1b9f2922f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.15

Release files / iputil-0.3.2-py3-none-any.whl

Download URL iputil-0.3.2-py3-none-any.whl
Size 4.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a8c4d43bbcd77e8145c77931a0f7363cc6bfe6cf12bbdf01d4606973ae05e8a9
BLAKE2b-256 checksum
How to use checksums
e8fb5b08452b879c149e7cfa4d38403f24b64a51b71f2a3f544f2c98e8c6bb0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.15

Security for iputil 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page