Skip to main content

Python wrapper library for the 'dig' command line tool

Project description

pydig

pydig is a python wrapper library for the 'dig' command line tool.

Build Status Python Versions License

Versioning

pydig follows SemVer (MAJOR.MINOR.PATCH) to track what is in each release.

  • Major version number will be bumped when there is an incompatible API change
  • Minor version number will be bumped when there is functionality added in a backwards-compatible manner.
  • Patch version number will be bumped when there is backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Installation

Installation the package from pypi with your tool of choice pip, poetry or pipenv.

pip install pydig

Usage

To use the default resolver you can call pydig.query this resolver will use the dig command found in your $PATH.

>>> import pydig
>>> pydig.query('example.com', 'A')
['93.184.216.34']
>>> pydig.query('www.github.com', 'CNAME')
['github.com.']
>>> pydig.query('example.com', 'NS')
['a.iana-servers.net.', 'b.iana-servers.net.']

If your want to adjust the executable location, the nameservers to dig will query against or would like to pass additional arguments/flags, you can configure your own instance of a resolver. and call the query method of your custom resolver.

>>> import pydig
>>> resolver = pydig.Resolver(
...     executable='/usr/bin/dig',
...     nameservers=[
...         '1.1.1.1',
...         '1.0.0.1',
...     ],
...     additional_args=[
...         '+time=10',
...     ]
... )
>>> resolver.query('example.com', 'A')
>>> ['93.184.216.34']

Documentation

The code is 150~ lines with 100% test coverage

https://github.com/leonsmith/pydig/tree/master/pydig

Support

If you’re interested in financially supporting open source, consider donating.

XLM Wallet BTC Wallet

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

pydig-0.2.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

pydig-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file pydig-0.2.0.tar.gz.

File metadata

  • Download URL: pydig-0.2.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.12 CPython/2.7.14 Darwin/18.5.0

File hashes

Hashes for pydig-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6c438a04120adc3b84118cb86c88cb6397b6d72683b94df442790649906f43f0
MD5 6b1fd7fd3f78ef33cc444bad96bd57da
BLAKE2b-256 13f78b2b5e78db2ff3dea379530429c08318411c3c63a53e935e19d08e183700

See more details on using hashes here.

File details

Details for the file pydig-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pydig-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.12 CPython/2.7.14 Darwin/18.5.0

File hashes

Hashes for pydig-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c43239cd831140ff9b142cce5200ab802e85cac74f7fd152301f5dc6abf9724
MD5 6b6c9e9dd21f0e1c257e3ffd0debc9a8
BLAKE2b-256 9fa0901e84d15a5c062f82e309bf5b2af4e16cd3bce243145038731cfc2c74f6

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