Skip to content

Commit d8e484c

Browse files
docs: Add docstrings to SeamWebhook class
1 parent b7b8020 commit d8e484c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

seam/seam_webhook.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,40 @@
44

55

66
class SeamWebhook:
7+
"""
8+
A class to handle Seam webhook verification.
9+
10+
This class provides functionality to verify incoming webhook payloads
11+
using the Svix library.
12+
"""
13+
714
def __init__(self, secret: str):
15+
"""
16+
Initialize the SeamWebhook instance.
17+
18+
Args:
19+
secret (str): The secret key used for webhook verification.
20+
"""
821
self._webhook = Webhook(secret)
922

1023
def verify(self, payload: str, headers: Dict[str, str]) -> SeamEvent:
24+
"""
25+
Verify the incoming webhook payload and headers.
26+
27+
This method normalizes the headers, verifies the payload using the Svix
28+
Webhook instance, and returns a SeamEvent object.
29+
30+
Args:
31+
payload (str): The webhook payload as a string.
32+
headers (Dict[str, str]): A dictionary of HTTP headers.
33+
34+
Returns:
35+
SeamEvent: An instance of SeamEvent created from the verified payload.
36+
37+
Raises:
38+
Any exceptions raised by the Svix Webhook.verify() method.
39+
"""
1140
normalized_headers = {k.lower(): v for k, v in headers.items()}
1241
res = self._webhook.verify(payload, normalized_headers)
1342

14-
return SeamEvent.from_dict(res)
43+
return SeamEvent.from_dict(res)

0 commit comments

Comments
 (0)