aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/console/common.py2
-rw-r--r--mitmproxy/console/flowlist.py2
-rw-r--r--mitmproxy/console/flowview.py2
-rw-r--r--mitmproxy/flow_export.py3
-rw-r--r--test/mitmproxy/test_flow_export.py9
5 files changed, 18 insertions, 0 deletions
diff --git a/mitmproxy/console/common.py b/mitmproxy/console/common.py
index c29ffddc..27e6b6db 100644
--- a/mitmproxy/console/common.py
+++ b/mitmproxy/console/common.py
@@ -286,6 +286,8 @@ def export_prompt(k, flow):
"c": flow_export.curl_command,
"p": flow_export.python_code,
"r": flow_export.raw_request,
+ "l": flow_export.locust_code,
+ "t": flow_export.locust_task,
}
if k in exporters:
copy_to_clipboard_or_prompt(exporters[k](flow))
diff --git a/mitmproxy/console/flowlist.py b/mitmproxy/console/flowlist.py
index c2201055..78b30231 100644
--- a/mitmproxy/console/flowlist.py
+++ b/mitmproxy/console/flowlist.py
@@ -265,6 +265,8 @@ class ConnectionItem(urwid.WidgetWrap):
("as curl command", "c"),
("as python code", "p"),
("as raw request", "r"),
+ ("as locust code", "l"),
+ ("as locust task", "t"),
),
callback = common.export_prompt,
args = (self.flow,)
diff --git a/mitmproxy/console/flowview.py b/mitmproxy/console/flowview.py
index f74ab140..ba2aad6a 100644
--- a/mitmproxy/console/flowview.py
+++ b/mitmproxy/console/flowview.py
@@ -585,6 +585,8 @@ class FlowView(tabs.Tabs):
("as curl command", "c"),
("as python code", "p"),
("as raw request", "r"),
+ ("as locust code", "l"),
+ ("as locust task", "t"),
),
callback = common.export_prompt,
args = (self.flow,)
diff --git a/mitmproxy/flow_export.py b/mitmproxy/flow_export.py
index a1e07953..f91a59a1 100644
--- a/mitmproxy/flow_export.py
+++ b/mitmproxy/flow_export.py
@@ -114,6 +114,9 @@ def locust_code(flow):
url=url,{args}
)
+ ### Additional tasks can go here ###
+
+
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=1000
diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py
index a4264e10..6654d990 100644
--- a/test/mitmproxy/test_flow_export.py
+++ b/test/mitmproxy/test_flow_export.py
@@ -205,6 +205,9 @@ class UserBehavior(TaskSet):
headers=headers,
)
+ ### Additional tasks can go here ###
+
+
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=1000
@@ -237,6 +240,9 @@ class UserBehavior(TaskSet):
data=data,
)
+ ### Additional tasks can go here ###
+
+
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=1000
@@ -280,6 +286,9 @@ class UserBehavior(TaskSet):
data=data,
)
+ ### Additional tasks can go here ###
+
+
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=1000