Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 9c47123

Browse files
committed
convert sets to list before sending event
1 parent 6687e77 commit 9c47123

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

data_diff/tracking.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ def create_email_signup_event_json(email: str) -> Dict[str, Any]:
201201
}
202202

203203

204+
def set_default(obj):
205+
if isinstance(obj, set):
206+
return list(obj)
207+
raise TypeError
208+
209+
204210
def send_event_json(event_json):
205211
if not g_tracking_enabled:
206212
raise RuntimeError("Won't send; tracking is disabled!")
@@ -209,7 +215,7 @@ def send_event_json(event_json):
209215
"Content-Type": "application/json",
210216
"Authorization": "Basic MkhndE00SGNxOUJtZWlDcU5ZaHo3Tzl0a2pNOg==",
211217
}
212-
data = json.dumps(event_json).encode()
218+
data = json.dumps(event_json, default=set_default).encode()
213219
try:
214220
req = urllib.request.Request(TRACK_URL, data=data, headers=headers)
215221
with urllib.request.urlopen(req, timeout=TIMEOUT) as f:

0 commit comments

Comments
 (0)