For basic authentication, you can use the httplib2 module for python. The following is an example. See this for more details.
>>>import httplib2 >>>h = httplib2.Http(".cache") >>>h.add_credentials('name', 'password') >>>resp, content = h.request("https://example.org/chap/2", "PUT", body="This is text", headers={'content-type':'text/plain'} )
I do not think Httplib2 provides proxy support. Check link -
Ameet source share