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

Implement SeamWebhook class for handling svix webhooks #60

Merged
merged 11 commits into from
May 22, 2024
271 changes: 270 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repository = "https://github.com/seamapi/python-next"
python = "^3.9.0"
dataclasses-json = "^0.6.4"
requests = "^2.26.0"
svix = "^1.24.0"

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
Expand Down
13 changes: 13 additions & 0 deletions seam/seam_webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Dict
from svix import Webhook
from .routes.types import Event


class SeamWebhook:
def __init__(self, secret: str):
self._webhook = Webhook(secret)

def verify(self, payload: str, headers: Dict[str, str]) -> Event:
res = self._webhook.verify(payload, headers)

return Event.from_dict(res)
Loading