flow.response.text.replace(self, pattern, repl, flags=0, count=0) |
替换response的内容 pattern:被替换的内容(正则表达式模式) repl:替换的内容 flags:标记数量 count:替换次数 |
常用于text.replace(‘xxx’,’xxx’) 与get_text()或text属性 配合使用即可 |
flow.response.make(status_code: int = 200, content: Union[bytes, str] = b'', headers: Union[mitmproxy.net.http.headers.Headers, Mapping[str, Union[str, bytes]], Iterable[Tuple[bytes, bytes]]] = ()) -> 'Response' |
生成新的response的 status_code、content、headers等等 用于修改或替换response 主要用途:捉弄别人 |
直接使用
flow.response.make(status_code=200,content=b'',headers={'xxx':'xxx'}) 返回Response对象 |
flow.response.refresh(self, now=None) |
让response响应进行重播 调整日期,过期和最后修改的标题 调整Cookie的到期时间 |
常用于refresh(new_time) 这个new_time可以和 Python的time模块配合
new_time=time.time() |