Skip to content

Commit 1ceff56

Browse files
committed
Adaptation for browserup proxy
1 parent 48accb7 commit 1ceff56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+340
-5232
lines changed

Diff for: .gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
*.pyc
44
dist/
55
build/
6+
venv/
7+
tools/
68
*.egg-info/
79
.cache/
8-
bmp.log
10+
.pytest_cache/
11+
bup.log
912
.idea/
13+
.DS_Store
14+
geckodriver.log
15+
server.log

Diff for: .travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ python:
1717
- 3.3
1818
- 3.4
1919
- 3.5
20+
- 3.6
2021
before_script:
2122
- export DISPLAY=:99.0
2223
- sh -e /etc/init.d/xvfb start

Diff for: CONTRIBUTING.md

-35
This file was deleted.

Diff for: History.md

-123
This file was deleted.

Diff for: bootstrap.sh

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
#!/usr/bin/env bash
2+
23
if [ "$(uname)" == "Darwin" ]; then
34
echo "We're on a MAC!"
45
chromeDriver="chromedriver_mac64.zip"
5-
geckoDriverVersion="v0.13.0"
6+
geckoDriverVersion="v0.24.0"
67
geckoDriver="geckodriver-$geckoDriverVersion-macos.tar.gz"
78
else
89
echo "We're not on a MAC!"
910
chromeDriver="chromedriver_linux64.zip"
10-
geckoDriverVersion="v0.14.0"
11+
geckoDriverVersion="v0.24.0"
1112
geckoDriver="geckodriver-$geckoDriverVersion-linux64.tar.gz"
1213
fi
1314
rm -rf tools
1415
mkdir -p tools && \
1516
cd tools && \
16-
wget https://github.com/lightbody/browsermob-proxy/releases/download/browsermob-proxy-2.1.4/browsermob-proxy-2.1.4-bin.zip && \
17-
unzip -o browsermob-proxy-2.1.4-bin.zip && \
18-
rm -rf browsermob-proxy*.zip* && \
19-
wget http://selenium-release.storage.googleapis.com/3.0/selenium-server-standalone-3.0.1.jar && \
17+
wget https://github.com/browserup/browserup-proxy/releases/download/v1.1.0/browserup-proxy-1.1.0.zip && \
18+
unzip -o browserup-proxy-1.1.0.zip && \
19+
rm -rf browserup-proxy*.zip* && \
20+
wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar && \
2021
wget https://github.com/mozilla/geckodriver/releases/download/${geckoDriverVersion}/${geckoDriver} && \
2122
tar zxf ${geckoDriver} && \
2223
rm -rf ${geckoDriver}* && \
23-
wget https://chromedriver.storage.googleapis.com/2.27/${chromeDriver} && \
24+
wget https://chromedriver.storage.googleapis.com/74.0.3729.6/${chromeDriver} && \
2425
unzip ${chromeDriver} && \
2526
rm -rf ${chromeDriver}* && \
26-
cd ..
27+
cd ..

Diff for: browsermobproxy/__init__.py

-6
This file was deleted.

Diff for: browserupproxy/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__version__ = '0.1.0'
2+
3+
from .server import RemoteServer, Server
4+
from .client import Client
5+
6+
__all__ = ['RemoteServer', 'Server', 'Client']

Diff for: browsermobproxy/client.py renamed to browserupproxy/client.py

+10-20
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, url, params=None, options=None):
1313
Initialises a new Client object
1414
1515
16-
:param url: This is where the BrowserMob Proxy lives
16+
:param url: This is where the BrowserUp Proxy lives
1717
:param params: URL query (for example httpProxy and httpsProxy vars)
1818
:param options: Dictionary that can contain the port of an existing
1919
proxy to use (for example 'existing_proxy_port_to_use')
@@ -33,7 +33,7 @@ def __init__(self, url, params=None, options=None):
3333
try:
3434
jcontent = json.loads(content)
3535
except Exception as e:
36-
raise Exception("Could not read Browsermob-Proxy json\n"
36+
raise Exception("Could not read Browserup-Proxy json\n"
3737
"Another server running on this port?\n%s..." % content[:512])
3838
self.port = jcontent['port']
3939
url_parts = self.host.split(":")
@@ -68,7 +68,7 @@ def webdriver_proxy(self):
6868
def add_to_capabilities(self, capabilities):
6969
"""
7070
Adds an 'proxy' entry to a desired capabilities dictionary with the
71-
BrowserMob proxy information
71+
BrowserUp proxy information
7272
7373
7474
:param capabilities: The Desired capabilities object from Selenium WebDriver
@@ -82,7 +82,7 @@ def add_to_capabilities(self, capabilities):
8282
def add_to_webdriver_capabilities(self, capabilities):
8383
self.add_to_capabilities(capabilities)
8484

85-
# browsermob proxy api
85+
# browserup proxy api
8686
@property
8787
def proxy_ports(self):
8888
"""
@@ -108,7 +108,7 @@ def new_har(self, ref=None, options=None, title=None):
108108
This sets a new HAR to be recorded
109109
110110
:param str ref: A reference for the HAR. Defaults to None
111-
:param dict options: A dictionary that will be passed to BrowserMob
111+
:param dict options: A dictionary that will be passed to BrowserUp
112112
Proxy with specific keywords. Keywords are:
113113
114114
- captureHeaders: Boolean, capture headers
@@ -200,8 +200,8 @@ def response_interceptor(self, js):
200200
"""
201201
Executes the java/js code against each response
202202
`HttpRequest request <https://netty.io/4.1/api/io/netty/handler/codec/http/HttpRequest.html>`_,
203-
`HttpMessageContents contents <https://raw.githubusercontent.com/lightbody/browsermob-proxy/master/browsermob-core/src/main/java/net/lightbody/bmp/util/HttpMessageContents.java>`_,
204-
`HttpMessageInfo messageInfo <https://raw.githubusercontent.com/lightbody/browsermob-proxy/master/browsermob-core/src/main/java/net/lightbody/bmp/util/HttpMessageInfo.java>`_
203+
`HttpMessageContents contents <https://raw.githubusercontent.com/browserup/browserup-proxy/master/browserup-proxy-core/src/main/java/com/browserup/bup/util/HttpMessageContents.java>`_,
204+
`HttpMessageInfo messageInfo <https://raw.githubusercontent.com/browserup/browserup-proxy/master/browserup-proxy-core/src/main/java/com/browserup/bup/util/HttpMessageInfo.java>`_
205205
are available objects to interact with.
206206
:param str js: the js/java code to execute
207207
"""
@@ -214,8 +214,8 @@ def request_interceptor(self, js):
214214
"""
215215
Executes the java/js code against each response
216216
`HttpRequest request <https://netty.io/4.1/api/io/netty/handler/codec/http/HttpRequest.html>`_,
217-
`HttpMessageContents contents <https://raw.githubusercontent.com/lightbody/browsermob-proxy/master/browsermob-core/src/main/java/net/lightbody/bmp/util/HttpMessageContents.java>`_,
218-
`HttpMessageInfo messageInfo <https://raw.githubusercontent.com/lightbody/browsermob-proxy/master/browsermob-core/src/main/java/net/lightbody/bmp/util/HttpMessageInfo.java>`_
217+
`HttpMessageContents contents <https://raw.githubusercontent.com/browserup/browserup-proxy/master/browserup-proxy-core/src/main/java/com/browserup/bup/util/HttpMessageContents.java>`_,
218+
`HttpMessageInfo messageInfo <https://raw.githubusercontent.com/browserup/browserup-proxy/master/browserup-proxy-core/src/main/java/com/browserup/bup/util/HttpMessageInfo.java>`_
219219
are available objects to interact with.
220220
:param str js: the js/java code to execute
221221
"""
@@ -293,7 +293,7 @@ def remap_hosts(self, address=None, ip_address=None, hostmap=None):
293293
:param str address: url that you wish to remap
294294
:param str ip_address: IP Address that will handle all traffic for
295295
the address passed in
296-
:param **hostmap: Other hosts to be added as keyword arguments
296+
:param hostmap: Other hosts to be added as keyword arguments
297297
"""
298298
hostmap = hostmap if hostmap is not None else {}
299299
if (address is not None and ip_address is not None):
@@ -347,13 +347,3 @@ def clear_all_rewrite_url_rules(self):
347347

348348
r = requests.delete('%s/proxy/%s/rewrite' % (self.host, self.port))
349349
return r.status_code
350-
351-
def retry(self, retry_count):
352-
"""
353-
Retries. No idea what its used for, but its in the API...
354-
355-
:param int retry_count: the number of retries
356-
"""
357-
r = requests.put('%s/proxy/%s/retry' % (self.host, self.port),
358-
{'retrycount': retry_count})
359-
return r.status_code
File renamed without changes.

0 commit comments

Comments
 (0)