Python SDK for NS1 DNS Platform

_images/ns1.png

About

This package provides an SDK for accessing the NS1 DNS platform and includes both a simple NS1 REST API wrapper as well as a higher level interface for managing zones, records, data feeds, and more. It supports synchronous and asynchronous transports.

Both python 2.7 and 3.3 are supported.

Install with:

$ pip install ns1-python

Quick Start

First, you’ll need an API Key. To create one, login to the portal and click on the Account button in the top right. Select Settings & Users, then add a new API Key at the bottom.

Simple example:

from ns1 import NS1

api = NS1(apiKey='<<CLEARTEXT API KEY>>')
zone = api.createZone('example.com', nx_ttl=3600)
print(zone)
record = zone.add_A('honey', ['1.2.3.4', '5.6.7.8'])
print(record)

Note that all zone and record changes propagate in real time throughout the NS1 platform.

There are more examples in the examples directory.

Contributions

We welcome contributions! Please fork on GitHub and submit a Pull Request.

Indices and tables