def verify(self):
try:<EOL><INDENT>if self.timestamp_mismatch is not None:<EOL><INDENT>m = _iso8601_timestamp_regex.match(self.request_timestamp)<EOL>year = int(m.group("<STR_LIT>"))<EOL>month = int(m.group("<STR_LIT>"))<EOL>day = int(m.group("<STR_LIT>"))<EOL>hour = int(m.group("<STR_LIT>"))<EOL>minute = int(m.group("<STR_LIT>"))<EOL>second = int(m.group("<STR_LIT>"))<EOL>req_ts = datetime(year, month, day, hour, minute, second)<EOL>now = datetime.utcnow()<EOL>if abs(req_ts - now) > timedelta(<NUM_LIT:0>, self.timestamp_mismatch):<EOL><INDENT>raise InvalidSignatureError("<STR_LIT>")<EOL><DEDENT><DEDENT>if self.expected_signature != self.request_signature:<EOL><INDENT>raise InvalidSignatureError(<EOL>"<STR_LIT>" % (<EOL>self.expected_signature, self.request_signature))<EOL><DEDENT><DEDENT>except (AttributeError, KeyError, ValueError) as e:<EOL><INDENT>raise InvalidSignatureError(str(e))<EOL><DEDENT>return True<EOL>
Verifies that the request timestamp is not beyond our allowable
timestamp mismatch and that the request signature matches our
expectations.