-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: custom encoding of the webhook payload
- Loading branch information
1 parent
7568f3d
commit da375d5
Showing
20 changed files
with
890 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
from django.core.serializers.json import DjangoJSONEncoder | ||
from django.utils.module_loading import import_string | ||
|
||
defaults = dict( | ||
PAYLOAD_ENCODER_CLASS=DjangoJSONEncoder, | ||
STORE_EVENTS=True, | ||
EVENTS_RETENTION_DAYS=30, | ||
USE_CACHE=True, | ||
) | ||
|
||
|
||
def get_settings(): | ||
# pylint: disable=redefined-outer-name,import-outside-toplevel | ||
from django.conf import settings | ||
|
||
user_defined_settings = getattr(settings, "DJANGO_WEBHOOK", {}) | ||
webhook_settings = {**defaults, **user_defined_settings} | ||
|
||
encoder_cls = webhook_settings["PAYLOAD_ENCODER_CLASS"] | ||
if isinstance(encoder_cls, str): | ||
webhook_settings["PAYLOAD_ENCODER_CLASS"] = import_string(encoder_cls) | ||
|
||
return webhook_settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.