The following shows an example:
import urllib2 # create credential for authentication user_agent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; FDM; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322)' key= 'YOUR ACCOUNT KEY' creds = (':%s' % key).encode('base64')[:-1] auth = 'Basic %s' % creds request = urllib2.Request('https://api.datamarket.azure.com/Data.ashx/Bing/Search/Web?Query=%27test%27&$top=5&$format=json') request.add_header('Authorization', auth) request.add_header('User-Agent', user_agent) requestor = urllib2.build_opener() result = requestor.open(request) print result.read()
Here, 'key' is your Account key in Windows Azure. You can find it here. You can replace the url used in urllib2.Request() to search what you want.