Skip to main content

Python custom resolver

Project description

DNS Mock

CodeQL codecov Python package

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dnsmock-21.2b2.tar.gz (16.8 kB view hashes)

Uploaded Source

Built Distribution

dnsmock-21.2b2-py2.py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page