DNS Mock
Python DNS Mock to bypass current DNS resolution. Emulates /etc/hosts inside a container.
Requirements
The dnsmock segment requires the standard library module socket. It provides access to the BSD socket interface.
Installation
Using pip
pip install dnsmock
Usage example
import dnsmock
import requests
dnsmock.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
License
Licensed under the MIT License.