Skip to main content

Python wrapper library for the 'dig' command line tool

Project description


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

Build Status Python Versions License


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 the package from pypi with your tool of choice pip, poetry or pipenv.

pip install pydig


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('', 'A')
>>> pydig.query('', 'CNAME')
>>> pydig.query('', 'NS')
['', '']

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=[
...         '',
...         '',
...     ],
...     additional_args=[
...         '+time=10',
...     ]
... )
>>> resolver.query('', 'A')
>>> ['']


The code is 150~ lines with 100% test coverage

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pydig, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size pydig-0.3.0-py3-none-any.whl (16.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pydig-0.3.0.tar.gz (15.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page