Is there any standard way of getting JSON data from RESTful service using Python?
I need to use kerberos for authentication.
some snippet would help.
Something like this should work unless I'm missing the point:
import json import urllib2 json.load(urllib2.urlopen("url"))
I would give the requests library a try for this. Essentially just a much easier to use wrapper around the standard library modules (i.e. urllib2, httplib2, etc.) you would use for the same thing. For example, to fetch json data from a url that requires basic authentication would look like this:
import requests response = requests.get('http://thedataishere.com', auth=('user', 'password')) data = response.json()
import requests from requests_kerberos import HTTPKerberosAuth response = requests.get('http://thedataishere.com', auth=HTTPKerberosAuth()) data = response.json()