Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imjoseangel/dnsmock
Python custom resolver
https://github.com/imjoseangel/dnsmock
contributions-welcome dns mock open-source python
Last synced: 17 days ago
JSON representation
Python custom resolver
- Host: GitHub
- URL: https://github.com/imjoseangel/dnsmock
- Owner: imjoseangel
- License: mit
- Created: 2021-11-28T21:33:35.000Z (about 3 years ago)
- Default Branch: devel
- Last Pushed: 2021-12-11T18:18:09.000Z (about 3 years ago)
- Last Synced: 2024-12-16T22:43:51.206Z (about 1 month ago)
- Topics: contributions-welcome, dns, mock, open-source, python
- Language: Python
- Homepage:
- Size: 67.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# DNS Mock
[![CodeQL](https://github.com/imjoseangel/dnsmock/workflows/CodeQL/badge.svg)](https://github.com/imjoseangel/dnsmock/security/code-scanning) [![codecov](https://codecov.io/gh/imjoseangel/dnsmock/branch/devel/graph/badge.svg)](https://codecov.io/gh/imjoseangel/dnsmock) [![Python package](https://github.com/imjoseangel/dnsmock/workflows/Python%20package/badge.svg)](https://pypi.org/project/dnsmock)
Python DNS Mock to bypass current DNS resolution. Emulates /etc/hosts inside a container.
## Requirements
The dnsmock segment requires the standard library module [socket][3]. It provides access to the BSD socket interface.
## Installation
### Using pip
```bash
pip install dnsmock
```## Usage example
```python
import dnsmock
import requestsdnsmock.bind_ip('www.example.com', 443, '127.0.0.1')
response = requests.get('https://www.example.com', verify=True)print(response.text)
```## Authors
Originally created by [@imjoseangel](http://github.com/imjoseangel)
## License
Licensed under [the MIT License][2].
[1]: https://imjoseangel.eu
[2]: https://github.com/imjoseangel/dnsmock/blob/devel/LICENSE
[3]: https://docs.python.org/3/library/socket.html