From fb69c9c3453142ae6beb4040295accb41fdc6878 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 16 Oct 2016 11:12:58 +1300 Subject: docs: overview, classes, arguments --- examples/arguments.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/arguments.py (limited to 'examples/arguments.py') diff --git a/examples/arguments.py b/examples/arguments.py new file mode 100644 index 00000000..70851192 --- /dev/null +++ b/examples/arguments.py @@ -0,0 +1,17 @@ +import argparse + + +class Replacer: + def __init__(self, src, dst): + self.src, self.dst = src, dst + + def response(self, flow): + flow.response.replace(self.src, self.dst) + + +def start(): + parser = argparse.ArgumentParser() + parser.add_argument("src", type=str) + parser.add_argument("dst", type=str) + args = parser.parse_args() + return Replacer(args.src, args.dst) -- cgit v1.2.3