viewdns
CLI and Python library for every ViewDNS.info API endpoint
Overview
viewdns is a Python toolkit that covers every endpoint of the ViewDNS.info API — reverse IP, WHOIS, DNS records, port scanning, IP geolocation, spam-database lookups, and more. It works both as a command-line tool and as an importable library, prints readable tables by default, and also speaks JSON, TOON, and raw XML. The HTTP layer uses only the Python standard library.
Key Features
| Feature | Description |
|---|---|
| All 23 endpoints | Complete coverage of the ViewDNS.info API from a single interface |
| Table by default | Human-readable output rendered with prettytable |
| Multi-format | table, json, toon (Token-Oriented Object Notation), and raw xml |
| CLI + Library | Use as a command-line tool or a typed Python package |
| File downloads | Streams the gzip-compressed Newly Registered Domains feed as raw bytes |
| Typed & tested | Fully type-checked (mypy --strict), 100% test coverage, no mocks |
| Zero-dependency HTTP | Transport built on http.client from the standard library |
Supported Outputs
Structured data table (prettytable), json, toon
Passthrough xml (raw API payload)
File feeds newly-registered -> gzip bytes (redirect to a file)
Errors API errors rendered as a key/value table
Installation
From PyPI (Recommended)
pip install viewdns
Set your API key once (get one from your ViewDNS.info account):
export VIEWDNS=your_api_key
From Source
git clone https://github.com/seifreed/viewdns.git
cd viewdns
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e ".[dev]"
Quick Start
# Reverse IP lookup (table by default)
viewdns reverse-ip --host google.com
# WHOIS for a domain
viewdns whois --domain example.com
# DNS records of a given type
viewdns dns-record --domain example.com --recordtype MX
# Your account balance
viewdns account --action balance
Usage
Command Line Interface
# JSON output
viewdns ip-location --ip 8.8.8.8 --format json
# TOON output
viewdns dns-record --domain google.com --recordtype A --format toon
# Raw XML from the API
viewdns whois --domain example.com --format xml
# Download the gzip Newly Registered Domains feed
viewdns newly-registered --date 2026-08-14 > nrd.txt.gz
--format selects the output (table default, json, toon, xml);
--apikey overrides $VIEWDNS; --timeout sets the request timeout in
seconds. Global options work before or after the subcommand. Run
viewdns --help for the full command list.
Endpoints
| Command | API path | Required | Optional |
|---|---|---|---|
abuse-contact |
abuselookup |
domain |
|
account |
account |
action |
|
chinese-firewall |
chinesefirewall |
domain |
|
dns-propagation |
propagation |
domain |
|
dns-record |
dnsrecord |
domain |
recordtype |
free-email |
freeemail |
domain |
|
http-headers |
httpheaders |
domain |
|
ip-history |
iphistory |
domain |
|
ip-location |
iplocation |
ip |
|
iran-firewall |
iranfirewall |
siteurl |
|
mac-lookup |
maclookup |
mac |
|
newly-registered |
nrd |
date |
type |
ping |
ping/v2 |
host |
|
port-scan |
portscan |
host |
|
reverse-dns |
reversedns |
ip |
|
reverse-ip |
reverseip |
host |
page |
reverse-mx |
reversemx |
mx |
page |
reverse-ns |
reversens |
ns |
page |
reverse-whois |
reversewhois |
q |
page |
spam-db |
spamdblookup |
ip |
|
subdomains |
subdomains |
domain |
|
traceroute |
traceroute |
domain |
|
whois |
whois/v2 |
domain |
Format Flags
| Option | Description |
|---|---|
--format table |
Human-readable tables (default) |
--format json |
Pretty-printed JSON |
--format toon |
Token-Oriented Object Notation |
--format xml |
Raw XML payload from the API |
--apikey <key> |
API key (defaults to $VIEWDNS) |
--timeout <seconds> |
Request timeout |
Python Library
Basic Usage
from viewdns import ViewDNSClient
client = ViewDNSClient("your_api_key")
data = client.request("reverse-ip", host="google.com")
whois = client.request("whois", domain="example.com")
xml = client.request("ip-location", ip="9.9.9.9", output="xml")
request returns parsed JSON (a dict) by default, the decoded text for
output="xml", and raw bytes for endpoints that serve a downloadable file.
Transport failures and unparseable responses raise ViewDNSError; invalid
arguments raise ValueError. API-level problems (bad key, exhausted quota,
missing subscription) come back inside the response payload.
Downloading a File Feed
gz = client.request("newly-registered", date="2026-08-14") # bytes
with open("nrd.txt.gz", "wb") as f:
f.write(gz)
Rendering Responses
from viewdns import render
print(render(data, "table")) # or "json" / "toon"
Requirements
- Python 3.14+
- Runtime dependencies:
prettytable,python-toon - See pyproject.toml for the full list and dev extras
Development
pip install -e ".[dev]"
black --check . && ruff check . && mypy .
bandit -r viewdns && pip-audit
pytest
Tests run real code against the live API (no mocks) and require $VIEWDNS.
Contributing
Contributions are welcome.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support the Project
If this project is useful in your workflows, you can support development:
License
This project is licensed under the MIT license. See LICENSE.
Attribution
- Author: Marc Rivero López | @seifreed
- Repository: github.com/seifreed/viewdns
Built for practical DNS/OSINT research and security automation
Metadata
Release files for viewdns 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| viewdns-1.0.0.tar.gz | 12.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| viewdns-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / viewdns-1.0.0.tar.gz
| Download URL | viewdns-1.0.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38c8de0bd13428faee6f0904bfdf836c46923aa64d19d3ecf433931454428f29
|
|
BLAKE2b-256 checksum How to use checksums |
21e82bbf7716ad22971479f55f57986ef0c880f68b821cff4e31883c4274b3bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logRelease files / viewdns-1.0.0-py3-none-any.whl
| Download URL | viewdns-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60131f02181348e7bf274c204db55d15216767fdb6dcc3eb528cf8ece589c5a0
|
|
BLAKE2b-256 checksum How to use checksums |
8b7aad4797ccf8b589aaef97024ce154c8828536cee48132ea678865d47676df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency log