|
| 1 | +[](https://travis-ci.org/ns1/ns1-python) [](https://ns1-python.readthedocs.io/en/latest/) |
| 2 | + |
| 3 | +NS1 Python SDK |
| 4 | +============== |
| 5 | + |
| 6 | +> This project is in [active development](https://github.com/ns1/community/blob/master/project_status/ACTIVE_DEVELOPMENT.md). |
| 7 | +
|
| 8 | +A Python SDK for accessing NS1, the Data Driven DNS platform. |
| 9 | + |
| 10 | +About |
| 11 | +===== |
| 12 | + |
| 13 | +This package provides a python SDK for accessing the NS1 DNS platform |
| 14 | +and includes both a simple NS1 REST API wrapper as well as a higher level |
| 15 | +interface for managing zones, records, data feeds, and more. |
| 16 | +It supports synchronous and asynchronous transports. |
| 17 | + |
| 18 | +Both python 2.7 and 3.3+ are supported. Automated tests are currently run |
| 19 | +against 2.7 and 3.6. |
| 20 | + |
| 21 | +Installation |
| 22 | +============ |
| 23 | + |
| 24 | + $ pip install ns1-python |
| 25 | + |
| 26 | +Dependencies |
| 27 | +============ |
| 28 | + |
| 29 | +None, but supports different transport backends. Currently supported: |
| 30 | + |
| 31 | +* [requests](http://docs.python-requests.org/en/latest/) (synchronous, the |
| 32 | + default if available) |
| 33 | +* urllib (synchronous, the default if requests isn't available) |
| 34 | +* [twisted](https://twistedmatrix.com/) (asynchronous, requires 2.7 or 3.5+) |
| 35 | + |
| 36 | +Other transports are easy to add, see |
| 37 | +[transport](https://github.com/ns1/ns1-python/tree/master/ns1/rest/transport) |
| 38 | + |
| 39 | +Examples |
| 40 | +======== |
| 41 | + |
| 42 | +See the [examples directory](https://github.com/ns1/ns1-python/tree/master/examples) |
| 43 | + |
| 44 | +Documentation |
| 45 | +============= |
| 46 | + |
| 47 | +If you don't yet have an NS1 account, [signup here (free)](https://ns1.com/signup/) |
| 48 | + |
| 49 | +You'll need an API Key. To create one, login to [the portal](https://my.nsone.net/) |
| 50 | +and click on the Account button in the top right. Select Settings & Users, then |
| 51 | +add a new API Key at the bottom. |
| 52 | + |
| 53 | +* [Documentation at ReadTheDocs](https://ns1-python.readthedocs.org/en/latest/) |
| 54 | +* [NS1 REST API Documentation](https://ns1.com/api/) |
| 55 | + |
| 56 | +Tests |
| 57 | +===== |
| 58 | + |
| 59 | +Unit tests use `pytest` (`pip install pytest`). 2.7 also requires `mock` to be |
| 60 | +installed (`pip install mock`). |
| 61 | + |
| 62 | +Tests should, of course, run and pass under python 2 and 3. We use tox to |
| 63 | +automate test runs and virtualenv setup, see `tox.ini` for config. |
| 64 | + |
| 65 | +Contributions |
| 66 | +============= |
| 67 | +Pull Requests and issues are welcome. See the |
| 68 | +[NS1 Contribution Guidelines](https://github.com/ns1/community) for more |
| 69 | +information. |
| 70 | + |
| 71 | +Our CI process will lint and check for formatting issues with `flake8` and |
| 72 | +`black`. |
| 73 | +It is suggested to run these checks prior to submitting a pull request and fix |
| 74 | +any issues: |
| 75 | +``` |
| 76 | +pip install flake8 black |
| 77 | +flake8 . --count --show-source --statistics --extend-ignore=E501 |
| 78 | +black . --check -l 79 --diff |
| 79 | +``` |
0 commit comments