Skip to content
20 changes: 20 additions & 0 deletions browsermobproxy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ def response_interceptor(self, js):
"""
Executes the javascript against each response

:param str js: the javascript to execute
"""
r = requests.post(url='%s/proxy/%s/interceptor/response' % (self.host, self.port),
data=js)
return r.status_code

def response_filter(self, js):
"""
Executes the javascript against each response

:param str js: the javascript to execute
"""
r = requests.post(url='%s/proxy/%s/filter/response' % (self.host, self.port),
Expand All @@ -208,6 +218,16 @@ def request_interceptor(self, js):
"""
Executes the javascript against each request

:param str js: the javascript to execute
"""
r = requests.post(url='%s/proxy/%s/interceptor/request' % (self.host, self.port),
data=js)
return r.status_code

def request_filter(self, js):
Copy link

@scythargon scythargon Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Could this method help me to prevent interception of all websocket connections according to this issue? lightbody/browsermob-proxy#408
If so - what should I write in js function?
Thanks in advance!

"""
Executes the javascript against each request

:param str js: the javascript to execute
"""
r = requests.post(url='%s/proxy/%s/filter/request' % (self.host, self.port),
Expand Down