GithubHelp home page GithubHelp logo

nic-api's Introduction

NIC.RU API wrapper library

The package is a wrapper for the API of Russian DNS registrar Ru-Center (a.k.a. NIC.RU). The library provides classes for managing DNS services, zones and records.

Installation

Using pip:

pip install nic-api

If you want to use the module in your project, add this line to the project's requirements.txt file:

nic-api

Usage

Initialization

To start using the API, you should get a pair of OAuth application login and password from NIC.RU. Here is the registration page: https://www.nic.ru/manager/oauth.cgi?step=oauth.app_register

Create an instance of nic_api.DnsApi and provide the OAuth application credentials:

Authorization

Call the authorize() method and specify the username and the password of your NIC.RU account, and a file to store the OAuth token for future use:

Now you are ready to use the API.

While the token in token_filename file is valid, you don't need to provide neither username or password to access the API - just create an instance of the DnsApi class with the same OAuth config, and pass only token_filename to the authorize() method.

Viewing services and DNS zones

In the NIC.RU, DNS zones are located in "services":

Usually there is one service per account. Let's view available zones in the service MY_SERVICE:

Always check if the zone has any uncommitted changes to it before making any modifications - your commit will apply other changes too!

Getting DNS records

For viewing or modifying records, you need to specify both service and DNS zone name:

Creating a record

To add a record, create an instance of one of the nic_api.models.DNSRecord subclasses, i.e. ARecord:

Add this record to the zone and commit the changes:

Deleting a record

Every record in the zone has an unique ID, and it's accessible via DNSRecord.id property. When you got the ID, pass it to the delete_record method:

Do not forget to always commit the changes!

nic-api's People

Contributors

andr1an avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.