Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing type annotations to python webhook verifier #149

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions generators/python/urllib3/templates/webhook_event_verifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hmac
import hashlib
from typing import Optional

from .models import WebhookEvent

Expand All @@ -9,10 +10,10 @@ class OnfidoInvalidSignatureError(Exception):


class WebhookEventVerifier:
def __init__(self, webhook_token):
def __init__(self, webhook_token: str) -> None:
self.webhook_token = webhook_token

def read_payload(self, raw_event, signature):
def read_payload(self, raw_event: str, signature: str) -> Optional[WebhookEvent]:
# Compute the the actual HMAC signature from the raw request body.
event_signature = hmac.new(
key=self.webhook_token.encode("utf-8"),
Expand Down
Loading