#NEWLINE# def _extract_metrics( self , page , status_code = 200 , id = None ) : #NEWLINE# #INDENT# if ( status_code != 200 ) : #NEWLINE# #INDENT# if ( status_code == 404 ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise self . _get_error ( status_code ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not ( '<response>' in page ) ) : #NEWLINE# #INDENT# raise ProviderContentMalformedError #NEWLINE# #UNINDENT# count = provider . _count_in_xml ( page , 'doc' ) #NEWLINE# if count : #NEWLINE# #INDENT# metrics_dict = { #NEWLINE# #INDENT# 'plossearch:mentions' : count , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# metrics_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return metrics_dict