IPsrv ipsrv db parsing library
Project description
ipsrvdb-python
Feature
- Support Python2 & Python3.
- Support IPv4 & IPv6.
- Support output db date, description and header.
- Support output raw IP info and IP info in a dinctionary.
- Support load the database into memory or using MMAP.
- No dependent.
Installing
pip install ipsrvdb
Example
import ipsrvdb
if __name__ == "__main__":
# mode options: MEMORY, MMAP
a = ipsrvdb.IPSrvDB("/path/to/ipsrv.dat", mode="MEMORY")
print(a.find('8.8.8.255'))
print(a.findx('8.8.8.255'))
print(a.findx('2001:250::ffff'))
print(a.get_header())
print(a.get_date())
print(a.get_description())
Output
NA,北美洲,US,美国,,,,,,
{u'isp_zh': u'', u'country_iso_code': u'US', u'country_zh': u'\u7f8e\u56fd', u'province_zh': u'', u'city_zh': u'', u'continent_code': u'NA', u'org': u'', u'continent_zh': u'\u5317\u7f8e\u6d32', u'city_code': u'', u'province_iso_code': u''}
{u'isp_zh': u'\u4e2d\u56fd\u6559\u80b2\u7f51', u'country_iso_code': u'CN', u'country_zh': u'\u4e2d\u56fd', u'province_zh': u'\u5317\u4eac\u5e02', u'city_zh': u'', u'continent_code': u'AS', u'org': u'', u'continent_zh': u'\u4e9a\u6d32', u'city_code': u'', u'province_iso_code': u'11'}
[u'continent_code', u'continent_zh', u'country_iso_code', u'country_zh', u'province_iso_code', u'province_zh', u'city_code', u'city_zh', u'isp_zh', u'org']
20210811
IPSrv, Inc. Dat database.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ipsrvdb-1.0.2.tar.gz
(2.9 kB
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 ipsrvdb-1.0.2.tar.gz.
File metadata
- Download URL: ipsrvdb-1.0.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/2.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a055a0ecd4d607eb9b63ae17190ce2498ab0a149d4ce7ac76ccaff5abb5e80c2
|
|
| MD5 |
b05b5348cba6974f0646c95687bab64a
|
|
| BLAKE2b-256 |
e0272a35aa471d2b9224bcdb999dc63e0c3d45f38dc677cb6c98ca6739a06663
|
File details
Details for the file ipsrvdb-1.0.2-py2-none-any.whl.
File metadata
- Download URL: ipsrvdb-1.0.2-py2-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/2.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf4925c58e560b4750d929df49f6b703d5bbc689257cda6ac1474a74867853d9
|
|
| MD5 |
ea0ca69f88bce2e398f106bb8931b40a
|
|
| BLAKE2b-256 |
efead250b447a1aaf04e44665968852ee95eace7f7ba8881cdfce3df2a80e4d7
|