Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No JSON object could be decoded" #84

Open
alex4200 opened this issue Jul 13, 2018 · 3 comments
Open

"No JSON object could be decoded" #84

alex4200 opened this issue Jul 13, 2018 · 3 comments

Comments

@alex4200
Copy link

I am using a MacBook Air with osX 10.13.5, prowsermob-proxy 2.1.4 (python part 0.8.0), selenium 3.13.0, firefox 61.0.1 and python 2.7.10, and trying to run essentially the example given in the README:

from browsermobproxy import Server
server = Server(path="./browsermob-proxy-2.1.4/bin/browsermob-proxy")

server.start()
proxy = server.create_proxy()

from selenium import webdriver
profile  = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)


proxy.new_har("google")
driver.get("http://www.google.co.uk")
print(proxy.har) # returns a HAR JSON blob

server.stop()
driver.quit()

However, printing the proxy.har does not see to work. I get the following error

Traceback (most recent call last):
  File "example.py", line 16, in <module>
    print(proxy.har) # returns a HAR JSON blob
  File "/Users/adietz/Work/20_BSP/Jenkins/Invest/Browsermobproxy/venv_mac/lib/python2.7/site-packages/browsermobproxy/client.py", line 104, in har
    return r.json()
  File "/Users/adietz/Work/20_BSP/Jenkins/Invest/Browsermobproxy/venv_mac/lib/python2.7/site-packages/requests/models.py", line 896, in json
    return complexjson.loads(self.text, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Maybe this is a bug on the python implementation?

@alex4200
Copy link
Author

I still get this error...

@markolofsen
Copy link

And me

@ketulhotstar
Copy link

Please resolve this asap. thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants