{"id":15609714,"url":"https://github.com/shizacat/aionic","last_synced_at":"2025-07-30T08:06:28.675Z","repository":{"id":57409051,"uuid":"449985370","full_name":"shizacat/aionic","owner":"shizacat","description":"Async Python library for the API of Russian DNS registrar Ru-Center (a.k.a. NIC.RU)","archived":false,"fork":false,"pushed_at":"2022-02-21T06:41:00.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T17:52:14.018Z","etag":null,"topics":["aiohttp","aiohttp-client","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shizacat.png","metadata":{"files":{"readme":"README.rst","changelog":"Changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-20T06:45:17.000Z","updated_at":"2022-01-26T13:44:32.000Z","dependencies_parsed_at":"2022-09-26T17:11:07.993Z","dependency_job_id":null,"html_url":"https://github.com/shizacat/aionic","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shizacat%2Faionic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shizacat%2Faionic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shizacat%2Faionic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shizacat%2Faionic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shizacat","download_url":"https://codeload.github.com/shizacat/aionic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246195326,"owners_count":20738849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohttp","aiohttp-client","python"],"created_at":"2024-10-03T06:00:51.859Z","updated_at":"2025-03-29T14:26:49.497Z","avatar_url":"https://github.com/shizacat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"NIC.RU API Python library\n==========================\n\nThe package is the async library for the API of Russian DNS registrator\nRu-Center (a.k.a. NIC.RU). It provides classes for managing DNS services,\nzones and records.\n\nThis project bases on: https://github.com/andr1an/nic-api\n\nInstallation\n------------\n\nUsing ``pip``::\n\n    pip install aionic\n\nUsage\n-----\n\nInitialization\n~~~~~~~~~~~~~~\n\nTo start using the API, you should get a pair of OAuth application login and\npassword from NIC.RU. Here is the registration page:\nhttps://www.nic.ru/manager/oauth.cgi?step=oauth.app_register\n\n\n.. code:: python\n\n    import asyncio\n    from nic_api import NICApi\n\n    def print_token(token: dict):\n        print(\"Token:\", token)\n\n    api = NICApi(\n        client_id = \"---\",\n        client_secret = \"---\",\n        username = \"---/NIC-D\",\n        password = \"---\",\n        scope = \"GET:/dns-master/.+\",\n        token_updater=print_token\n    )\n\n    # First you need to get token\n    async def main():\n        await api.get_token()\n\n    asyncio.run(main)\n\nGet token\n~~~~~~~~~\n\nCall the ``get_token()`` method:\n\n.. code:: python\n\n    # First you need to get token\n    async def main():\n        await api.get_token()\n\n    asyncio.run(main)\n\nNow you are ready to use the API.\n\nA token can be saved anywhere, for example, to a file, using the callback:\n``token_updater``. It also could be used for authorization.\nNeither password nor username is required as long as the token is valid.\n\nViewing services and DNS zones\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOn ``nic.ru`` DNS zones are located in \"services\":\n\n.. code:: python\n\n    api.services()\n\nUsually there is one service per account. Let's view available zones in the\nservice ``MY_SERVICE``:\n\n.. code:: python\n\n    async def main():\n        await api.zones('MY_SERVICE')\n\n    asyncio.run(main)\n\n**When starting a modification make sure that there is no any uncommited\nchanges in the zone, cause they would be applied on commit.**\n\nGetting DNS records\n~~~~~~~~~~~~~~~~~~~\n\nOne has to specify both service and DNS zone name to view or modify a record:\n\n.. code:: python\n\n    async def main():\n        await api.records('MY_SERIVCE', 'example.com')\n\n    asyncio.run(main)\n\nCreating a record\n~~~~~~~~~~~~~~~~~\n\nTo add a record, create an instance of one of the ``nic_api.models.DNSRecord``\nsubclasses, i.e. ``ARecord``:\n\n.. code:: python\n\n    import aionic.models as nic_models\n    record_www = nic_models.ARecord(name='www', a='8.8.8.8', ttl=3600)\n\nAdd this record to the zone and commit the changes:\n\n.. code:: python\n\n    async def main():\n        await api.add_record(record_www, 'MY_SERVICE', 'example.com')\n        await api.commit('MY_SERVICE', 'example.com')\n\n    asyncio.run(main)\n\nDeleting a record\n~~~~~~~~~~~~~~~~~\n\nEvery record in the zone has an unique ID, and it's accessible via\n``DNSRecord.id`` property. When you got the ID, pass it to the\n``delete_record`` method:\n\n.. code:: python\n\n    async def main():\n        await api.delete_record(10, 'MY_SERVICE', 'example.com')\n        await api.commit('MY_SERVICE', 'example.com')\n\n    asyncio.run(main)\n\nDo not forget to always commit the changes!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshizacat%2Faionic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshizacat%2Faionic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshizacat%2Faionic/lists"}