From a18db90ea3123b37e3f1fd3f10da001a8ea893c2 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 4 Sep 2015 00:46:42 +0200 Subject: update example inline scripts --- examples/redirect_requests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/redirect_requests.py') diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py index 48512f1b..2ae4927b 100644 --- a/examples/redirect_requests.py +++ b/examples/redirect_requests.py @@ -1,9 +1,8 @@ -from libmproxy.protocol.http import HTTPResponse -from netlib.odict import ODictCaseless - """ This example shows two ways to redirect flows to other destinations. """ +from libmproxy.models import HTTPResponse +from netlib.odict import ODictCaseless def request(context, flow): -- cgit v1.2.3 From 5125c669ccd2db5de5f90c66db61e64f63f3ba4c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 5 Sep 2015 20:45:58 +0200 Subject: adjust to new netlib Headers class --- examples/redirect_requests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/redirect_requests.py') diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py index 2ae4927b..ca24c42a 100644 --- a/examples/redirect_requests.py +++ b/examples/redirect_requests.py @@ -2,8 +2,7 @@ This example shows two ways to redirect flows to other destinations. """ from libmproxy.models import HTTPResponse -from netlib.odict import ODictCaseless - +from netlib.http import Headers def request(context, flow): # pretty_host(hostheader=True) takes the Host: header of the request into account, @@ -14,7 +13,7 @@ def request(context, flow): if flow.request.pretty_host(hostheader=True).endswith("example.com"): resp = HTTPResponse( [1, 1], 200, "OK", - ODictCaseless([["Content-Type", "text/html"]]), + Headers(Content_Type="text/html"), "helloworld") flow.reply(resp) -- cgit v1.2.3