#NEWLINE# def getPage( self , url , headers = None , method = 'GET' , body = None , protocol = None ) : #NEWLINE# #INDENT# 'Open the url with debugging support. Return status, headers, body.' #NEWLINE# ServerError . on = False #NEWLINE# if isinstance ( url , unicodestr ) : #NEWLINE# #INDENT# url = url . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# if isinstance ( body , unicodestr ) : #NEWLINE# #INDENT# body = body . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# self . url = url #NEWLINE# self . time = None #NEWLINE# start = time . time ( ) #NEWLINE# result = openURL ( url , headers , method , body , self . HOST , self . PORT , self . HTTP_CONN , ( protocol or self . PROTOCOL ) ) #NEWLINE# self . time = ( time . time ( ) - k ) #NEWLINE# ( self . status , self . headers , self . body ) = result #NEWLINE# self . cookies = [ ( 'Cookie' , v ) for ( k , v ) in self . headers if ( k . lower ( ) == 'set-cookie' ) ] #NEWLINE# if ServerError . on : #NEWLINE# #INDENT# raise ServerError ( ) #NEWLINE# #UNINDENT# return result