browsermob-proxy icon indicating copy to clipboard operation
browsermob-proxy copied to clipboard

Problems with har on osx

Open Virgula0 opened this issue 5 years ago • 2 comments

I'm trying to use proxy.newHar in python but this throws an exception:

from browsermobproxy import Server
dict={'port':7070}
server = Server(path="./browsermob-proxy-2.1.4/bin/browsermob-proxy",options=dict)
server.start()
proxy = server.create_proxy()

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

profile  = webdriver.ChromeOptions()
profile.add_argument('--proxy-server=%s' % (proxy.proxy))
profile.add_argument('--ignore-ssl-errors=yes')
profile.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(ChromeDriverManager().install(),chrome_options=profile)
proxy.new_har("google")
driver.get("http://www.google.co.uk")
proxy.har # returns a HAR JSON blob

server.stop()

but I get:

Traceback (most recent call last):
  File "test.py", line 17, in <module>
    proxy.har # returns a HAR JSON blob
  File "/usr/local/lib/python3.8/site-packages/browsermobproxy/client.py", line 104, in har
    return r.json()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Virgula0 avatar Sep 08 '20 12:09 Virgula0

I have the same problem. It worked until 2 months ago and suddenly crashed on one day.

eric1932 avatar Oct 09 '20 04:10 eric1932

I got the sameproblem.anyone can help?

jrr997 avatar Oct 21 '20 09:10 jrr997