aboutsummaryrefslogtreecommitdiffstats
path: root/examples/redirect_requests.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-19 15:25:39 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-19 20:26:05 +1300
commit24cf8da27eb56a65bf3e4ceb78bbeacdb1864597 (patch)
treefee98428fbf36897aa874fd91fe5c9738bf2626f /examples/redirect_requests.py
parent5a68d21e8c87e05f2ad0c18e6c7c505f5e9fc93d (diff)
downloadmitmproxy-24cf8da27eb56a65bf3e4ceb78bbeacdb1864597.tar.gz
mitmproxy-24cf8da27eb56a65bf3e4ceb78bbeacdb1864597.tar.bz2
mitmproxy-24cf8da27eb56a65bf3e4ceb78bbeacdb1864597.zip
Move all tools into mitmproxy.tools, move models/* to top level
The primary motivation here (and for all the other moving around) is to present a clean "front of house" to library users, and to migrate primary objects to the top of the module hierarchy.
Diffstat (limited to 'examples/redirect_requests.py')
-rw-r--r--examples/redirect_requests.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py
index bbb84e2f..c28042db 100644
--- a/examples/redirect_requests.py
+++ b/examples/redirect_requests.py
@@ -1,7 +1,7 @@
"""
This example shows two ways to redirect flows to other destinations.
"""
-from mitmproxy.models import HTTPResponse
+from mitmproxy import http
def request(flow):
@@ -11,7 +11,7 @@ def request(flow):
# Method 1: Answer with a locally generated response
if flow.request.pretty_host.endswith("example.com"):
- flow.response = HTTPResponse.make(200, b"Hello World", {"Content-Type": "text/html"})
+ flow.response = http.HTTPResponse.make(200, b"Hello World", {"Content-Type": "text/html"})
# Method 2: Redirect the request to a different server
if flow.request.pretty_host.endswith("example.org"):