#NEWLINE# def init_http( ) : #NEWLINE# #INDENT# handlers = [ _UserAgentHandler ( ) ] #NEWLINE# mgr = urllib . request . HTTPPasswordMgrWithDefaultRealm ( ) #NEWLINE# try : #NEWLINE# #INDENT# n = netrc . netrc ( ) #NEWLINE# for host in n . hosts : #NEWLINE# #INDENT# p = n . hosts [ host ] #NEWLINE# mgr . add_password ( p [ 1 ] , ( 'http://%s/' % host ) , p [ 0 ] , p [ 2 ] ) #NEWLINE# mgr . add_password ( p [ 1 ] , ( 'https://%s/' % host ) , url [ 0 ] , p [ 2 ] ) #NEWLINE# #UNINDENT# #UNINDENT# except netrc . NetrcParseError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# handlers . append ( _BasicAuthHandler ( mgr ) ) #NEWLINE# handlers . append ( _DigestAuthHandler ( mgr ) ) #NEWLINE# if kerberos : #NEWLINE# #INDENT# handlers . append ( _KerberosAuthHandler ( ) ) #NEWLINE# #UNINDENT# if ( 'http_proxy' in os . environ ) : #NEWLINE# #INDENT# url = os . environ [ 'http_proxy' ] #NEWLINE# handlers . append ( urllib . request . ProxyHandler ( { #NEWLINE# #INDENT# 'http' : url , #NEWLINE# 'https' : url , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# if ( 'REPO_CURL_VERBOSE' in os . environ ) : #NEWLINE# #INDENT# handlers . append ( urllib . request . HTTPHandler ( debuglevel = 1 ) ) #NEWLINE# handlers . append ( urllib . request . HTTPSHandler ( debuglevel = 1 ) ) #NEWLINE# #UNINDENT# urllib . request . install_opener ( urllib . request . build_opener ( * handlers ) )