Add an example showing the new form API.

This commit is contained in:
Aldo Cortesi
2012-02-23 14:57:43 +13:00
parent 3f6619ff59
commit bc3bf969ba
2 changed files with 9 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
add_header.py Simple script that just adds a header to every request.
flowbasic Basic use of mitmproxy as a library.
modify_form.py Modify all form submissions to add a parameter.
stub.py Script stub with a method definition for every event.
stickycookies An example of writing a custom proxy with libmproxy.
upsidedownternet.py Rewrites traffic to turn PNGs upside down.

8
examples/modify_form.py Normal file
View File

@@ -0,0 +1,8 @@
def request(context, flow):
if "application/x-www-form-urlencoded" in flow.request.headers["content-type"]:
frm = flow.request.get_form_urlencoded()
frm["mitmproxy"] = ["rocks"]
flow.request.set_form_urlencoded(frm)