mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-24 04:14:57 +08:00
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.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import random
|
||||
import sys
|
||||
from mimtproxy import io
|
||||
from mitmproxy import io
|
||||
|
||||
|
||||
class Writer:
|
||||
|
||||
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user