Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wslyvh committed Aug 21, 2024
1 parent 0e3b2df commit d0d6764
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pretalx_webhook/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.1"
__version__ = "0.1.0"
9 changes: 4 additions & 5 deletions pretalx_webhook/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
@receiver(schedule_release, dispatch_uid="pretalx_webhook_schedule_release")
def on_schedule_release(sender, schedule, user, **kwargs):
try:
# Get the webhook settings for this event
webhook_settings = settings.PLUGIN_SETTINGS["pretalx_webhook"]
if not webhook_settings:
logger.info(f"Webhook settings are empty or invalid for event {sender.slug}")
logger.error(f"Webhook settings are empty or invalid for event {sender.slug}")
return

webhook_endpoint = webhook_settings["endpoint"]
webhook_secret = webhook_settings["secret"]

if not webhook_endpoint:
logger.info(f"Webhook endpoint is empty for event {sender.slug}")
logger.error(f"Webhook endpoint is empty for event {sender.slug}")
return

logger.error(f"Schedule changes: {schedule.changes}")
logger.info(f"Preparing payload for {sender.slug} with schedule {schedule.version}")
payload = {
'event': sender.slug,
'user': str(user),
Expand All @@ -41,7 +40,7 @@ def on_schedule_release(sender, schedule, user, **kwargs):
else:
logger.warning(f"Webhook secret is empty for event {sender.slug}")

logger.error(f"Send JSON request to {webhook_endpoint} with payload: {payload}")
logger.info(f"POST JSON request to {webhook_endpoint} with payload: {payload}")
response = requests.post(webhook_endpoint,
json=json.dumps(payload),
headers=headers,
Expand Down

0 comments on commit d0d6764

Please sign in to comment.