{"id":18298236,"url":"https://github.com/s3rgeym/python-dns-client","last_synced_at":"2025-09-11T17:24:17.992Z","repository":{"id":225271259,"uuid":"765542307","full_name":"s3rgeym/python-dns-client","owner":"s3rgeym","description":"Python DNS Client Library","archived":false,"fork":false,"pushed_at":"2024-03-04T09:07:14.000Z","size":64,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T03:24:14.929Z","etag":null,"topics":["dig","dns","internet","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s3rgeym.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-01T05:56:42.000Z","updated_at":"2024-03-01T07:55:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"993bff1f-22ea-4762-900f-be93b2474753","html_url":"https://github.com/s3rgeym/python-dns-client","commit_stats":null,"previous_names":["s3rgeym/python-dns-client"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rgeym%2Fpython-dns-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rgeym%2Fpython-dns-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rgeym%2Fpython-dns-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rgeym%2Fpython-dns-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s3rgeym","download_url":"https://codeload.github.com/s3rgeym/python-dns-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008626,"owners_count":21032556,"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":["dig","dns","internet","python"],"created_at":"2024-11-05T15:05:33.603Z","updated_at":"2025-04-09T09:16:25.301Z","avatar_url":"https://github.com/s3rgeym.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python DNS Client Library\n\n[ ![PyPI - Python Version](https://img.shields.io/pypi/v/dns-client) ]()\n[ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dns-client) ]()\n[ ![PyPI - Downloads](https://img.shields.io/pypi/dm/dns-client) ]()\n\nPython client library for sending DNS queries.\n\nFeaturtes:\n\n* supports DNS over TLS (DOT)\n* contains adapter for requests\n* threadsafe\n* null-dependency\n\nInstall:\n\n```bash\n# from pypi.org\npip install dns-client\n\n# latest commit\npip install git+https://github.com/s3rgeym/python-dns-client.git\n```\n\nExamples:\n\n```python\nIn [1]: from dns_client import DNSClient, RecordType\n\nIn [2]: c = DNSClient('1.1.1.1', over_tls=True)\n\nIn [3]: c.query('ya.ru', RecordType.AAAA)\nOut[3]: [Record(name='ya.ru', qtype=\u003cRecordType.AAAA: 28\u003e, qclass=\u003cRecordClass.IN: 1\u003e, ttl=76, value='2a02:6b8::2:242')]\n\nIn [4]: c.query('ya.ru', RecordType.MX)\nOut[4]: [Record(name='ya.ru', qtype=\u003cRecordType.MX: 15\u003e, qclass=\u003cRecordClass.IN: 1\u003e, ttl=2242, value=(10, 'mx.yandex.ru'))]\n\nIn [5]: c.get_query_response('ya.ru')\nOut[5]: Packet(header=Header(id=47527, response=True, opcode=\u003cOpCode.QUERY: 0\u003e, authoritative=False, truncated=False, recursion_desired=True, recursion_available=True, reserved=False, authentic_data=False, check_disabled=False, rcode=\u003cResponseCode.NOERROR: 0\u003e, num_questions=1, num_records=2, num_authorities=0, num_additionals=0), questions=[Question(name='ya.ru', qtype=\u003cRecordType.A: 1\u003e, qclass=\u003cRecordClass.IN: 1\u003e)], records=[Record(name='ya.ru', qtype=\u003cRecordType.A: 1\u003e, qclass=\u003cRecordClass.IN: 1\u003e, ttl=266, value='77.88.55.242'), Record(name='ya.ru', qtype=\u003cRecordType.A: 1\u003e, qclass=\u003cRecordClass.IN: 1\u003e, ttl=266, value='5.255.255.242')])\n\nIn [6]: c.get_all_records('ya.ru')\nOut[6]:\n[('A', '5.255.255.242'),\n ('A', '77.88.55.242'),\n ('AAAA', '2a02:6b8::2:242'),\n ('MX', (10, 'mx.yandex.ru')),\n ('NS', 'ns1.yandex.ru'),\n ('NS', 'ns2.yandex.ru'),\n ('TXT',\n  '_globalsign-domain-verification=eLi0_-xATuNmRfuTIX8VQIvgfyi7Od7Hph4V0yNisF'),\n ('TXT',\n  '_globalsign-domain-verification=xUUDG4u7Zo56EmmFewz7Y4UK3MfAU7QSjAgBsy0w6q'),\n ('TXT',\n  'google-site-verification=SVTEeUiCU4KV-5qGw4o4JPok7mfsP8NtQTIdN6tt6Nw'),\n ('TXT', 'v=spf1 redirect=_spf.yandex.ru'),\n ('TXT',\n  '_globalsign-domain-verification=dHoe580bPQ-lfi_vh-BEIwB4NAtUwURIzrzsivByVL'),\n ('TXT', 'e1c8e4dd3d13fad0dd9e8ed54a1813ececd3d5412fb16c4ed2c0612332950fe')]\n```\n\nYou can use `dns-client` with `requests`:\n\n```python\nfrom dns_client.adapters.requests import DNSClientSession\n\ns = DNSClientSession('8.8.8.8')\nr = s.get('https://google.com')\nprint(r.headers)\n```\n\nCLI Usage:\n\n```bash\n$ python -m dns_client ya.ru -t ns -H 8.8.8.8 --tls -pr\nResponse Flags = 0x8180\n\n1... .... .... .... = Response (True)\n.000 0... .... .... = Opcode (\u003cOpCode.QUERY: 0\u003e)\n.... .0.. .... .... = Authoritative (False)\n.... ..0. .... .... = Truncated (False)\n.... ...1 .... .... = Recursion Desired (True)\n.... .... 1... .... = Recursion Available (True)\n.... .... .0.. .... = Reserved (False)\n.... .... ..0. .... = Authentic Data (False)\n.... .... ...0 .... = Check Disabled (False)\n.... .... .... 0000 = Rcode (\u003cResponseCode.NOERROR: 0\u003e)\n\nNumber of Records       : 2\nNumber of Questions     : 1\nNumber of Authorities   : 0\nNumber of Additionals   : 0\n\nns1.yandex.ru\nns2.yandex.ru\n```\n\n| Arg | Desc |\n| --- | --- |\n| `-t` | record type |\n| `-H` | dns address |\n| `--tls` | dns over tls aka d.o.t. |\n| `-pr` | print response |\n\nSee all arguments:\n\n```bash\npython -m dns_client -h\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs3rgeym%2Fpython-dns-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs3rgeym%2Fpython-dns-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs3rgeym%2Fpython-dns-client/lists"}