Skip to content

Some fixes and additional options. #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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