Can I make rest API calls?

import urllib2 import json def get_data(self): # Test an HTTP request response = urllib2.urlopen('https://somedata') data = json.load(response) print data

Also I keep getting 'open is not whitelisted error