{"id":18657692,"url":"https://github.com/cle-b/hookdns","last_synced_at":"2025-04-11T18:31:43.158Z","repository":{"id":37773894,"uuid":"163427403","full_name":"cle-b/hookdns","owner":"cle-b","description":"An easy way to customize the dns resolution in your Python scripts.","archived":false,"fork":false,"pushed_at":"2025-01-12T16:53:11.000Z","size":55,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-22T09:07:15.858Z","etag":null,"topics":["dns","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cle-b.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":"2018-12-28T16:04:03.000Z","updated_at":"2025-01-12T16:47:56.000Z","dependencies_parsed_at":"2022-08-18T16:50:51.723Z","dependency_job_id":"f3435db7-67f5-41f6-b490-7dd19708630e","html_url":"https://github.com/cle-b/hookdns","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Fhookdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Fhookdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Fhookdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Fhookdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cle-b","download_url":"https://codeload.github.com/cle-b/hookdns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248458528,"owners_count":21107096,"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":["dns","python"],"created_at":"2024-11-07T07:29:35.240Z","updated_at":"2025-04-11T18:31:43.149Z","avatar_url":"https://github.com/cle-b.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/cle-b/hookdns/actions/workflows/build.yml/badge.svg)](https://github.com/cle-b/hookdns/actions/workflows/build.yml) [![Coverage Status](https://coveralls.io/repos/github/cle-b/hookdns/badge.svg?branch=main)](https://coveralls.io/github/cle-b/hookdns?branch=main) [![PyPI version](https://badge.fury.io/py/hookdns.svg)](https://pypi.org/project/hookdns/)\n\n# hookdns\n\nHookDNS is a library which allow you to modify a name resolution in your Python script without any modification in your hosts file or by using a fake DNS resolver.\n\n```python\nimport requests\n\nfrom hookdns import hosts\n\nwith hosts({\"example.org\": \"127.0.0.1\"}):\n    ...\n    r = requests.get(\"http://example.org\")  # the request is sent to your local server\n    ...\n```\n\n## Installation\n\n```\npip install hookdns\n```\n\n## Usage\n\nCustom DNS resolutions are describe by a dictionnary where the keys are hostnames\nand the values the expected corresponding addresses.    \n\n    {\n        \"hostname1\": \"addr1\",\n        \"hostname2\": \"addr2\"\n    }\n\nhostname and addr could be a domain name or a string representation of an IPv4/IPV6.\n\n### Example using the patch as a decorator\n\n```python\nimport requests\n\nfrom hookdns import hosts\n\n@hosts({\"example.org\": \"127.0.0.1\"})\ndef myfunc():\n    ...\n    r = requests.get(\"http://example.org\")  # the request is sent to your local server\n    ...\n```\n\n### Example using the patch as a context manager\n\n```python\nimport requests\n\nfrom hookdns import hosts\n\nwith hosts({\"example.org\": \"localhost\"}):\n    ...\n    r = requests.get(\"http://example.org\")  # the request is sent to your local server\n    ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcle-b%2Fhookdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcle-b%2Fhookdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcle-b%2Fhookdns/lists"}