Skip to main content

IPsrv ipsrv db parsing library

Project description

ipsrvdb-python

Feature

  1. Support Python2 & Python3.
  2. Support IPv4 & IPv6.
  3. Support output db date, description and header.
  4. Support output raw IP info and IP info in a dinctionary.
  5. Support load the database into memory or using MMAP.
  6. 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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipsrvdb-1.0.2-py2-none-any.whl (7.4 kB view details)

Uploaded Python 2

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

Hashes for ipsrvdb-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a055a0ecd4d607eb9b63ae17190ce2498ab0a149d4ce7ac76ccaff5abb5e80c2
MD5 b05b5348cba6974f0646c95687bab64a
BLAKE2b-256 e0272a35aa471d2b9224bcdb999dc63e0c3d45f38dc677cb6c98ca6739a06663

See more details on using hashes here.

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

Hashes for ipsrvdb-1.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 bf4925c58e560b4750d929df49f6b703d5bbc689257cda6ac1474a74867853d9
MD5 ea0ca69f88bce2e398f106bb8931b40a
BLAKE2b-256 efead250b447a1aaf04e44665968852ee95eace7f7ba8881cdfce3df2a80e4d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page