#NEWLINE# @ classmethod #NEWLINE# def validate_hmac( cls , params ) : #NEWLINE# #INDENT# if ( 'hmac' not in params ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# hmac_calculated = cls . calculate_hmac ( params ) . encode ( 'utf-8' ) #NEWLINE# hmac_to_verify = params [ 'hmac' ] . encode ( 'utf-8' ) #NEWLINE# try : #NEWLINE# #INDENT# return hmac . compare_digest ( hmac_calculated , hmac_to_verify ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return ( hmac_calculated == hmac_to_verify )