Skip to content

Commit bde4655

Browse files
committed
fixes to analytics api
1 parent ae79c84 commit bde4655

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

supertokens_python/recipe/dashboard/api/analytics.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ async def handle_analytics_post(
5757
NormalisedURLPath("/telemetry")
5858
)
5959
if response is not None:
60-
telemetry_id = response["telemetryId"]
60+
if (
61+
"exists" in response
62+
and response["exists"]
63+
and "telemetryId" in response
64+
):
65+
telemetry_id = response["telemetryId"]
6166

6267
number_of_users = await Supertokens.get_instance().get_user_count(
6368
include_recipe_ids=None
@@ -74,17 +79,19 @@ async def handle_analytics_post(
7479
)
7580

7681
data = {
77-
"websiteDomain": websiteDomain,
78-
"apiDomain": apiDomain,
82+
"websiteDomain": websiteDomain.get_as_string_dangerous(),
83+
"apiDomain": apiDomain.get_as_string_dangerous(),
7984
"appName": appName,
8085
"sdk": "supertokens-python",
8186
"sdkVersion": SDKVersion,
82-
"telemetryId": telemetry_id,
8387
"numberOfUsers": number_of_users,
8488
"email": email,
8589
"dashboardVersion": dashboard_version,
8690
}
8791

92+
if telemetry_id is not None:
93+
data["telemetryId"] = telemetry_id
94+
8895
try:
8996
async with AsyncClient() as client:
9097
await client.post( # type: ignore

0 commit comments

Comments
 (0)