python - No JSON object could be decoded for the web APIs -


i new python, , repeating solved examples book "python data analysis"

in 1 example, need access apis twitter search. here code:

import requests url='https://twitter.com/search?q=python%20pandas&src=typd' resp=requests.get(url) 

everything works okay here. problems comes when use json

import json data=json.loads(resp.text) 

then received error message valueerror: no json object decoded

i tried switch url instead of twitter, still receive same error message.

does have ideas? thanks

you need response json content. search twitter requires use of api.twitter.com, need oauth key. it's more complicated 5 lines of code have. see http://nbviewer.ipython.org/github/chdoig/mining-the-social-web-2nd-edition/blob/master/ipynb/chapter%201%20-%20mining%20twitter.ipynb


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -