#NEWLINE# def set_url( self , url ) : #NEWLINE# #INDENT# path = url . lstrip ( '/' ) #NEWLINE# if ( url . startswith ( 'http://' ) or url . startswith ( 'https://' ) ) : #NEWLINE# #INDENT# u = urlparse . urlsplit ( url ) #NEWLINE# if ( u . username is not None ) : #NEWLINE# #INDENT# password = ( u . password or '' ) #NEWLINE# encode = base64 . b64encode ( ( '%s:%s' % ( u . username , password ) ) ) #NEWLINE# self . headers [ 'Authorization' ] = ( 'Basic %s' % encode ) #NEWLINE# #UNINDENT# self . scheme = ( u . scheme , ) #NEWLINE# self . host = u . netloc . split ( '@' ) [ ( - 1 ) ] #NEWLINE# self . path_info = ( u . path or '/' ) #NEWLINE# self . query_string = u . query #NEWLINE# url = urlparse . urlunsplit ( ( u . scheme , u . netloc . split ( '@' ) [ ( - 1 ) ] , u . path , u . query , u . fragment ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( '?' in path ) : #NEWLINE# #INDENT# ( path , self . query_string ) = path . split ( '?' , 1 ) #NEWLINE# #UNINDENT# self . path_info = ( '/' + path ) #NEWLINE# url = self . url #NEWLINE# #UNINDENT# ( self . scheme , self . host , self . path_info ) = urlparse . urlparse ( url ) [ 0 : 3 ]