dnsmock
1.0.0
Python DNS Mock to bypass current DNS resolution. Emulates /etc/hosts inside a container.
The dnsmock segment requires the standard library module socket. It provides access to the BSD socket interface.
pip install dnsmockimport 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)Originally created by @imjoseangel
Licensed under the MIT License.