blob: ddf0a99f7ac208d9347ef9e41bc1fc0c8e392fcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
---
title: "Events"
menu:
addons:
weight: 2
---
# Events
Addons hook into mitmproxy's internal mechanisms through events. These are
implemented on addons as methods with a set of well-known names. Many events
receive `Flow` objects as arguments - by modifying these objects, addons can
change traffic on the fly. For instance, here is an addon that adds a response
header with a count of the number of responses seen:
{{< example src="examples/addons/addheader.py" lang="py" >}}
## Supported Events
Below is an addon class that implements stubs for all events. We've added
annotations to illustrate the argument types for the various events.
### Generic Events
{{< example src="examples/addons/events.py" lang="py" >}}
### HTTP Events
{{< example src="examples/addons/events-http-specific.py" lang="py" >}}
### WebSocket Events
{{< example src="examples/addons/events-websocket-specific.py" lang="py" >}}
### TCP Events
{{< example src="examples/addons/events-tcp-specific.py" lang="py" >}}
|