browsermob-proxy-py
browsermob-proxy-py
Release 0.6.0
David Burns
1 How to install 3
3 How to Contribute 7
3.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Making Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Submitting Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
i
ii
BrowserMob Proxy Documentation, Release 0.6.0
Contents 1
BrowserMob Proxy Documentation, Release 0.6.0
2 Contents
CHAPTER 1
How to install
Or with easy_install:
$ easy_install browsermob-proxy
3
BrowserMob Proxy Documentation, Release 0.6.0
Manually:
proxy.new_har("google")
driver.get("http://www.google.co.uk")
proxy.har # returns a HAR JSON blob
server.stop()
driver.quit()
5
BrowserMob Proxy Documentation, Release 0.6.0
How to Contribute
Getting Started
Making Changes
• Create a topic branch from where you want to base your work. * This is usually the master branch. * Only
target release branches if you are certain your fix must be on that
branch.
– To quickly create a topic branch based on master; git checkout -b /my_contribution master. Please avoid
working directly on the master branch.
• Make commits of logical units.
• Check for unnecessary whitespace with git diff –check before committing.
• Make sure you have added the necessary tests for your changes.
• Run _all_ the tests to assure nothing else was accidentally broken.
7
BrowserMob Proxy Documentation, Release 0.6.0
Submitting Changes
client Package
headers(headers)
This sets the headers that will set by the proxy on all requests
Parameters headers (dict) – this is a dictionary of the headers to be set
limits(options)
Limit the bandwidth through the proxy.
Parameters options (dict) – A dictionary with all the details you want to set. down-
stream_kbps - Sets the downstream kbps upstream_kbps - Sets the upstream kbps latency
- Add the given latency to each HTTP request
new_har(ref=None, options=None, title=None)
This sets a new HAR to be recorded
Parameters
• ref (str) – A reference for the HAR. Defaults to None
• options (dict) – A dictionary that will be passed to BrowserMob Proxy with specific
keywords. Keywords are:
– captureHeaders: Boolean, capture headers
– captureContent: Boolean, capture content bodies
– captureBinaryContent: Boolean, capture binary content
• title (str) – the title of first har page. Defaults to ref.
new_page(ref=None, title=None)
This sets a new page to be recorded
Parameters
• ref (str) – A reference for the new page. Defaults to None
• title (str) – the title of new har page. Defaults to ref.
proxy_ports
Return a list of proxy ports available
remap_hosts(address=None, ip_address=None, hostmap=None)
Remap the hosts for a specific URL
Parameters
• address (str) – url that you wish to remap
• ip_address (str) – IP Address that will handle all traffic for the address passed in
• **hostmap – Other hosts to be added as keyword arguments
request_interceptor(js)
Executes the java/js code against each response HttpRequest request, HttpMessageContents contents,
HttpMessageInfo messageInfo are available objects to interact with. :param str js: the js/java code to
execute
response_interceptor(js)
Executes the java/js code against each response HttpRequest request, HttpMessageContents contents,
HttpMessageInfo messageInfo are available objects to interact with. :param str js: the js/java code to
execute
retry(retry_count)
Retries. No idea what its used for, but its in the API...
server Package
• genindex
• modindex
• search
b
browsermobproxy, 10
13
BrowserMob Proxy Documentation, Release 0.6.0
H
har (browsermobproxy.Client attribute), 8
headers() (browsermobproxy.Client method), 8
L
limits() (browsermobproxy.Client method), 9
N
new_har() (browsermobproxy.Client method), 9
new_page() (browsermobproxy.Client method), 9
P
proxy_ports (browsermobproxy.Client attribute), 9
R
remap_hosts() (browsermobproxy.Client method), 9
request_interceptor() (browsermobproxy.Client method),
9
response_interceptor() (browsermobproxy.Client
method), 9
retry() (browsermobproxy.Client method), 9
15