def verify_request_signature(request: RequestType, public_key: Union[str, bytes]):
key = encode_if_text(public_key)<EOL>date_header = request.headers.get("<STR_LIT>")<EOL>if not date_header:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>ts = parse_http_date(date_header)<EOL>dt = datetime.datetime.utcfromtimestamp(ts).replace(tzinfo=pytz.utc)<EOL>delta = datetime.timedelta(seconds=<NUM_LIT:30>)<EOL>now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc)<EOL>if dt < now - delta or dt > now + delta:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>HTTPSignatureHeaderAuth.verify(request, key_resolver=lambda **kwargs: key)<EOL>
Verify HTTP signature in request against a public key.