mtmproxy http get request in script

2019-08-27 12:57发布

问题:

How to make http request in response (script)

class Intercept:
    def response(self, flow: HTTPFlow):
        t_id = flow.request.query.get('task_id')
        if not t_id:
            return

        rsp = requests.get(
            'https://example.com/v1/tasks', {'task_id': t_id})

        data = rsp.json()


addons = [
    Intercept()
]

this code block mitmproxy response