Python urllib2: Receive JSON response from url -
i trying url using python , response json. however, when run
import urllib2 response = urllib2.urlopen('https://api.instagram.com/v1/tags/pizza/media/xxxxxx') html=response.read() print html
the html of type str , expecting json. there way can capture response json or python dictionary instead of str.
if url returning valid json-encoded data, use json
library decode that:
import urllib2 import json response = urllib2.urlopen('https://api.instagram.com/v1/tags/pizza/media/xxxxxx') data = json.load(response) print data
Comments
Post a Comment