@@ -81,7 +81,7 @@ def add_to_webdriver_capabilities(self, capabilities):
8181 @property
8282 def proxy_ports (self ):
8383 """
84- Return a list of proxy ports available
84+ Return a list of proxy ports available
8585 """
8686 # r should look like {u'proxyList': [{u'port': 8081}]}
8787 r = requests .get ('%s/proxy' % self .host ).json ()
@@ -103,13 +103,15 @@ def new_har(self, ref=None, options=None, title=None):
103103 """
104104 This sets a new HAR to be recorded
105105
106- :param ref: A reference for the HAR. Defaults to None
107- :param options: A dictionary that will be passed to BrowserMob Proxy \
108- with specific keywords. Keywords are: \
109- captureHeaders - Boolean, capture headers \
110- captureContent - Boolean, capture content bodies \
111- captureBinaryContent - Boolean, capture binary content
112- :param title: the title of first har page. Defaults to ref.
106+ :param str ref: A reference for the HAR. Defaults to None
107+ :param dict options: A dictionary that will be passed to BrowserMob
108+ Proxy with specific keywords. Keywords are:
109+
110+ - captureHeaders: Boolean, capture headers
111+ - captureContent: Boolean, capture content bodies
112+ - captureBinaryContent: Boolean, capture binary content
113+
114+ :param str title: the title of first har page. Defaults to ref.
113115 """
114116 options = options if options is not None else {}
115117 payload = {"initialPageRef" : ref } if ref is not None else {}
@@ -129,8 +131,8 @@ def new_page(self, ref=None, title=None):
129131 """
130132 This sets a new page to be recorded
131133
132- :param ref: A reference for the new page. Defaults to None
133- :param title: the title of new har page. Defaults to ref.
134+ :param str ref: A reference for the new page. Defaults to None
135+ :param str title: the title of new har page. Defaults to ref.
134136 """
135137 payload = {"pageRef" : ref } if ref is not None else {}
136138 if title is not None :
@@ -143,11 +145,9 @@ def blacklist(self, regexp, status_code):
143145 """
144146 Sets a list of URL patterns to blacklist
145147
146-
147- :param regex: a comma separated list of regular expressions
148- :param status_code: the HTTP status code to return for URLs that do not \
149- match the blacklist
150-
148+ :param str regex: a comma separated list of regular expressions
149+ :param int status_code: the HTTP status code to return for URLs
150+ that do not match the blacklist
151151 """
152152 r = requests .put ('%s/proxy/%s/blacklist' % (self .host , self .port ),
153153 {'regex' : regexp , 'status' : status_code })
@@ -157,10 +157,9 @@ def whitelist(self, regexp, status_code):
157157 """
158158 Sets a list of URL patterns to whitelist
159159
160-
161- :param regex: a comma separated list of regular expressions
162- :param status_code: the HTTP status code to return for URLs that do not \
163- match the whitelist
160+ :param str regex: a comma separated list of regular expressions
161+ :param int status_code: the HTTP status code to return for URLs
162+ that do not match the whitelist
164163 """
165164 r = requests .put ('%s/proxy/%s/whitelist' % (self .host , self .port ),
166165 {'regex' : regexp , 'status' : status_code })
@@ -170,10 +169,9 @@ def basic_authentication(self, domain, username, password):
170169 """
171170 This add automatic basic authentication
172171
173-
174- :param domain: domain to set authentication credentials for
175- :param username: valid username to use when authenticating
176- :param password: valid password to use when authenticating
172+ :param str domain: domain to set authentication credentials for
173+ :param str username: valid username to use when authenticating
174+ :param str password: valid password to use when authenticating
177175 """
178176 r = requests .post (url = '%s/proxy/%s/auth/basic/%s' % (self .host , self .port , domain ),
179177 data = json .dumps ({'username' : username , 'password' : password }),
@@ -184,8 +182,7 @@ def headers(self, headers):
184182 """
185183 This sets the headers that will set by the proxy on all requests
186184
187-
188- :param headers: this is a dictionary of the headers to be set
185+ :param dict headers: this is a dictionary of the headers to be set
189186 """
190187 if not isinstance (headers , dict ):
191188 raise TypeError ("headers needs to be dictionary" )
@@ -199,8 +196,7 @@ def response_interceptor(self, js):
199196 """
200197 Executes the javascript against each response
201198
202-
203- :param js: the javascript to execute
199+ :param str js: the javascript to execute
204200 """
205201 r = requests .post (url = '%s/proxy/%s/filter/response' % (self .host , self .port ),
206202 data = js ,
@@ -211,8 +207,7 @@ def request_interceptor(self, js):
211207 """
212208 Executes the javascript against each request
213209
214-
215- :param js: the javascript to execute
210+ :param str js: the javascript to execute
216211 """
217212 r = requests .post (url = '%s/proxy/%s/filter/request' % (self .host , self .port ),
218213 data = js ,
@@ -229,11 +224,10 @@ def limits(self, options):
229224 """
230225 Limit the bandwidth through the proxy.
231226
232-
233- :param options: A dictionary with all the details you want to set. \
234- downstreamKbps - Sets the downstream kbps \
235- upstreamKbps - Sets the upstream kbps \
236- latency - Add the given latency to each HTTP request
227+ :param dict options: A dictionary with all the details you want to set.
228+ downstreamKbps - Sets the downstream kbps
229+ upstreamKbps - Sets the upstream kbps
230+ latency - Add the given latency to each HTTP request
237231 """
238232 params = {}
239233
@@ -261,12 +255,11 @@ def timeouts(self, options):
261255 """
262256 Configure various timeouts in the proxy
263257
264-
265- :param options: A dictionary with all the details you want to set. \
266- request - request timeout (in seconds) \
267- read - read timeout (in seconds) \
268- connection - connection timeout (in seconds) \
269- dns - dns lookup timeout (in seconds)
258+ :param dict options: A dictionary with all the details you want to set.
259+ request - request timeout (in seconds)
260+ read - read timeout (in seconds)
261+ connection - connection timeout (in seconds)
262+ dns - dns lookup timeout (in seconds)
270263 """
271264 params = {}
272265
@@ -287,8 +280,9 @@ def remap_hosts(self, address=None, ip_address=None, hostmap=None):
287280 """
288281 Remap the hosts for a specific URL
289282
290- :param address: url that you wish to remap
291- :param ip_address: IP Address that will handle all traffic for the address passed in
283+ :param str address: url that you wish to remap
284+ :param str ip_address: IP Address that will handle all traffic for
285+ the address passed in
292286 :param **hostmap: Other hosts to be added as keyword arguments
293287 """
294288 hostmap = hostmap if hostmap is not None else {}
@@ -304,9 +298,9 @@ def wait_for_traffic_to_stop(self, quiet_period, timeout):
304298 """
305299 Waits for the network to be quiet
306300
307-
308- :param quiet_period: number of miliseconds the network needs to be quiet for
309- :param timeout: max number of miliseconds to wait
301+ :param int quiet_period: number of milliseconds the network needs
302+ to be quiet for
303+ :param int timeout: max number of milliseconds to wait
310304 """
311305 r = requests .put ('%s/proxy/%s/wait' % (self .host , self .port ),
312306 {'quietPeriodInMs' : quiet_period , 'timeoutInMs' : timeout })
@@ -323,7 +317,6 @@ def rewrite_url(self, match, replace):
323317 """
324318 Rewrites the requested url.
325319
326-
327320 :param match: a regex to match requests with
328321 :param replace: unicode \
329322 a string to replace the matches with
@@ -340,8 +333,7 @@ def retry(self, retry_count):
340333 """
341334 Retries. No idea what its used for, but its in the API...
342335
343-
344- :param retry_count: the number of retries
336+ :param int retry_count: the number of retries
345337 """
346338 r = requests .put ('%s/proxy/%s/retry' % (self .host , self .port ),
347339 {'retrycount' : retry_count })
0 commit comments