From 7fc2ebe953d48b4ad2ec7259968d837b1bf09a0d Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 9 Oct 2023 08:34:42 -0600 Subject: [PATCH] analytics: use yarl.URL instead of urlunparse Signed-off-by: Sumner Evans --- linkedin_matrix/analytics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linkedin_matrix/analytics.py b/linkedin_matrix/analytics.py index 79778ae..980aac1 100644 --- a/linkedin_matrix/analytics.py +++ b/linkedin_matrix/analytics.py @@ -1,8 +1,8 @@ from __future__ import annotations -from urllib.parse import urlunparse import logging +from yarl import URL import aiohttp from mautrix.util import background_task @@ -11,7 +11,7 @@ log = logging.getLogger("mau.web.public.analytics") http: aiohttp.ClientSession | None = None -analytics_url: str | None = None +analytics_url: URL | None = None analytics_token: str | None = None analytics_user_id: str | None = None @@ -42,7 +42,7 @@ def init(base_url: str | None, token: str | None, user_id: str | None = None): return log.info("Initialising segment-compatible analytics") global analytics_url, analytics_token, analytics_user_id, http - analytics_url = urlunparse(("https", base_url, "/v1/track", "", "", "")) + analytics_url = URL.build(scheme="https", host=base_url, path="/v1/track") analytics_token = token analytics_user_id = user_id http = aiohttp.ClientSession()