#NEWLINE# def submit( self , redirect_limit = 0 , **response_kwargs ) : #NEWLINE# #INDENT# ' Submit this HTTP request.\n\n        :rtype: :class:`httpstream.Response`\n\n        ' #NEWLINE# uri = self . uri #NEWLINE# while True : #NEWLINE# #INDENT# ( http , rs ) = submit ( self . method , uri , self . body , self . headers ) #NEWLINE# status_class = ( rs . status // 100 ) #NEWLINE# if ( status_class == 3 ) : #NEWLINE# #INDENT# redirection = Redirection ( http , uri , self , rs , ** response_kwargs ) #NEWLINE# if redirect_limit : #NEWLINE# #INDENT# redirect_limit -= 1 #NEWLINE# location_string = rs . getheader ( 'Location' , None ) #NEWLINE# if ( location_string is None ) : #NEWLINE# #INDENT# return redirection #NEWLINE# #UNINDENT# location = URI . resolve ( rs , location_string ) #NEWLINE# if ( location == uri ) : #NEWLINE# #INDENT# raise RedirectionError ( 'Circular redirection' ) #NEWLINE# #UNINDENT# if ( rs . status in ( MOVED_PERMANENTLY , PERMANENT_REDIRECT ) ) : #NEWLINE# #INDENT# redirects [ uri ] = location #NEWLINE# #UNINDENT# uri = location #NEWLINE# redirection . close ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return redirection #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return Response . wrap ( http , uri , self , rs , ** response_kwargs )