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 py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page