Skip to content

Commit 63871a3

Browse files
csalazarespenfjo
authored andcommitted
Added support for parameters in har creation
1 parent 611866c commit 63871a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

browsermobproxy/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def har(self):
6363

6464
return r.json()
6565

66-
def new_har(self, ref=None):
66+
def new_har(self, ref=None, options={}):
6767
"""
6868
This sets a new HAR to be recorded
6969
:Args:
@@ -73,6 +73,9 @@ def new_har(self, ref=None):
7373
payload = {"initialPageRef": ref}
7474
else:
7575
payload = {}
76+
if options:
77+
payload.update(options)
78+
7679
r = requests.put('%s/proxy/%s/har' % (self.host, self.port), payload)
7780
if r.status_code == 200:
7881
return (r.status_code, r.json())
@@ -237,7 +240,7 @@ def remap_hosts(self, address, ip_address):
237240
- ip_address - IP Address that will handle all traffic for the address passed in
238241
"""
239242
assert address is not None and ip_address is not None
240-
r = requests.post('%s/proxy/%s/hosts' % (self.host, self.port),
243+
r = requests.post('%s/proxy/%s/hosts' % (self.host, self.port),
241244
json.dumps({address: ip_address}),
242245
headers={'content-type': 'application/json'})
243246
return r.status_code

0 commit comments

Comments
 (0)