authhandler = urllib.request.HTTPBasicAuthHandler(passman)
opener = urllib.request.build_opener(authhandler)
urllib.request.install_opener(opener)
pagehandle = urllib.request.urlopen(theurl)
Basic authentication using urllib2 with python with JIRA REST api