mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
08895e9ba6
- restructure examples (fix #4031) - remove example dependencies from setup.py, we do not need special dependencies for our supported addons. - unify how we generate docs from code - improve example docs
21 lines
320 B
Python
21 lines
320 B
Python
"""
|
|
Basic skeleton of a mitmproxy addon.
|
|
|
|
Run as follows: mitmproxy -s anatomy.py
|
|
"""
|
|
from mitmproxy import ctx
|
|
|
|
|
|
class Counter:
|
|
def __init__(self):
|
|
self.num = 0
|
|
|
|
def request(self, flow):
|
|
self.num = self.num + 1
|
|
ctx.log.info("We've seen %d flows" % self.num)
|
|
|
|
|
|
addons = [
|
|
Counter()
|
|
]
|