def response(self, flow: mitmproxy.http.HTTPFlow): """ The full HTTP response has been read. """ # response_header = eval(dict(flow.response.headers)['response_header']) # # '''解码图片''' # # if flow.response.headers['Content-Type'].startswith('image/'): # # with open(r'C:\Users\xh\proxy_yct\csdn-kf.png', 'wb') as f: # # f.write(flow.response.content) connect = filter_info['http_connect'] data_dict = {} for i in connect: url_res = flow.request.url if i in url_res and 'x=11' not in url_res: data_dict = self.yct_dealdatabag(flow) break else: # data_dict = self.other_dealdatabag(flow) continue if data_dict: pickled = pickle.dumps(data_dict) data_str = str(pickled) main.handle_data(data_str)
def run_celery(self, data_str): #这个地方调用任务to_product handle_data(data_str)