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:
Aldo Cortesi
2016-10-19 15:25:39 +13:00
parent 5a68d21e8c
commit 24cf8da27e
95 changed files with 381 additions and 378 deletions

View File

@@ -1,6 +1,6 @@
import random
import sys
from mimtproxy import io
from mitmproxy import io
class Writer:

View File

@@ -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"):