Skip to content

Commit

Permalink
Encode Smee body content with compat json settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sodre committed May 1, 2020
1 parent 711fb5f commit d87a816
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zeroae/smee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# ------------------------------------------------------------------------------

"""Webhook data delivery client. Please visit https://smee.io for more information."""
import json
import logging
from dataclasses import dataclass

Expand Down Expand Up @@ -52,11 +53,11 @@ def on_ready(self, event):

def on_message(self, event: event_stream.Event):
smee_event = event.json()
body = smee_event.pop("body")
body = json.dumps(smee_event.pop("body"), separators=(",", ":"))
_ = smee_event.pop("query")
_ = smee_event.pop("timestamp")
try:
requests.post(self.target, json=body, headers=smee_event)
requests.post(self.target, data=body, headers=smee_event)
except requests.exceptions.ConnectionError:
logger.warning(
f"Event {event.id} was not delivered. Target did not respond."
Expand Down

0 comments on commit d87a816

Please sign in to comment.