Here are few snippets to make secure http requests using various python libraries. httplib2 import httplib2 link = " h = httplib2.Http(".cache") r, content = h.request(link, "GET") another exmaple import httplib2 h = httplib2.Http(".cache") h.add_credentials('user', 'pass') r, content = h.request("", "GET") print r['status'] print r['content-type'] Urllib2 Here is a simmilar example using urlib2 for comparison and lines of code. import urllib2 gh_url = '' auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password(None, gh_url, 'user', 'password') opener = urllib2.