Skip to main content

Python client library for Reverse NS API.

Project description

reverse-ns-py license reverse-ns-py release reverse-ns-py build

Overview

The client library for Reverse NS API in Python language.

The minimum Python version is 3.6.

Installation

pip install reverse-ns

Examples

Full API documentation available here

Create a new client

from reversens import *

client = Client('Your API key')

Make basic requests

# Get categories for a domain name.
response = client.get('ns.google.com')
for row in response.result:
    print("Domain: " + row.name)

Advanced usage

Extra request parameters

# Iterating over all pages
# Specify the target name server.
client.name_server = "ns2.google.com"

# Now you can use the `Client` instance as an iterable object
for page in client:
    # Precess the data:
    for row in page.result:
        print(row.name)

# You can access the last response object via `last_result` property
print(client.last_result.size)
# Please note, that `client.get_raw(...)` method doesn't
# update value of the `last_result` field.
# Also, `iter(client)` will reset the `last_result` value to None

# Getting raw API response in XML
xml = client.get_raw('ns.google.com', output_format=Client.XML_FORMAT)

Using Response model reference

response = client.get('....')

# Getting list of domains
response.result
# Checking the size of the domain list
response.size
# Checking if there is a next page
if response.has_next():
    ....

# `current_page` shows the `search_from` value
...
r = client.get(ns='ns', search_from='last.domain.of.the.previous.page.com')
print(r.current_page)
# >>'last.domain.of.the.previous.page.com'

Changelog

1.0.0 (2021-07-09)

  • First release

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

reverse-ns-1.0.0.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

reverse_ns-1.0.0-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

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