#NEWLINE# @ classmethod #NEWLINE# def _fetch_remote( cls , uri , depth_indicator = 1 ) : #NEWLINE# #INDENT# '\n        return remote document and actual remote uri\n        :type uri: str\n        :type depth_indicator: int\n        :rtype: (document: str | None, uri)\n        ' #NEWLINE# cls . _log ( 'debug' , ( 'fetch remote(%d): %s' % ( depth_indicator , uri ) ) ) #NEWLINE# request = Request ( uri , headers = cls . request_headers ( ) ) #NEWLINE# response = urlopen ( request , timeout = cls . request_timeout ( ) ) #NEWLINE# if ( not response ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# uri = response . geturl ( ) #NEWLINE# charset = 'utf8' #NEWLINE# try : #NEWLINE# #INDENT# charset = response . info ( ) . get_param ( 'charset' , charset ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return ( response . read ( ) . decode ( charset ) , uri )