In python, I want to send a request to a url which will return some information to me. The problem is if I try to access the url from the browser, a popup box appears and asks for a username and password. I have a username and password for this url however, I don't know how to make python automatically complete these fields to access the URL.
This is my code that returns a 401 error:
bing = "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%
(term)s&$top=50&$format=json" %__function()
results = urllib2.urlopen(bing).read()
EDIT: Just for clarification, the function function returns a variable called term which is the term being queried in the URL