pyipextract
Python utility to extract or validate IPv4 addresses
IPv4 Extraction
- It can extract valid IPv4 addresses from a given string
- Returns a list of all valid IPv4 addresses extracted from a given string
IPv4 Validation
- Can also be used just to validate an IPv4address
Installation
pip install pyipextract
How to use
Here's an example of calling IPExtractor constructor and using the extraction or just validation
mechanisms
Extraction
from pyipextract import IPExtractor
input_str = "This is a string which contains valid IPs 192.168.1.1, 1.1.1.1 and an invalid IP 256.444.22.22"
ip_extractor = IPExtractor()
extracted_ips = ip_extractor.extract(input_str)
print(extracted_ips)
Output:
['192.168.1.1', '1.1.1.1']
Validation
from pyipextract import IPExtractor
ips = ["192.168.1.1", "256.444.22.22", "1.1.1.1111"]
ip_extractor = IPExtractor()
for value in ips:
if ip_extractor.validate(value):
print("Valid IP: {}".format(value))
else:
print("Invalid IP: {}".format(value))
Output
Valid IP: 192.168.1.1
Invalid IP: 256.444.22.22
Invalid IP: 1.1.1.1111
Release files for pyipextract 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyipextract-1.0.2.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyipextract-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / pyipextract-1.0.2.tar.gz
| Download URL | pyipextract-1.0.2.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d974c791a22bbba45e4459543b0c89fae2278b0316b1e190cae34c4b7ed2573
|
|
BLAKE2b-256 checksum How to use checksums |
054e7a1a915dc0fb4441758691ad7c0f5c696232c85bf300cfca86ada23d34d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.5
|
Release files / pyipextract-1.0.2-py3-none-any.whl
| Download URL | pyipextract-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5872c347e768a75adcaeede636d8c7aea974302ebe2a0e87837788a7e3a5d82a
|
|
BLAKE2b-256 checksum How to use checksums |
5f2a9b981735663152510ff858632bea9bb434b0a77d93e1a7ded6bb4cb3e2ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.5
|