diff --git a/push_to_3yourmind/api/base.py b/push_to_3yourmind/api/base.py index 38b6b95..2664902 100644 --- a/push_to_3yourmind/api/base.py +++ b/push_to_3yourmind/api/base.py @@ -1,8 +1,8 @@ """ Base classes """ -import os import typing as t +import urllib import requests @@ -26,7 +26,7 @@ def __init__(self, access_token: str, base_url: str): "Create token" in the user list. base_url: application URL, ex. https://app.3yourmind.com """ - self._api_prefix = "api/v2.0" + self._api_prefix = "api/v2.0/" self._access_token = access_token self._base_url = base_url @@ -38,8 +38,8 @@ def _get_url(self, sub_path: str) -> str: :return: """ - path = os.path.join(self._api_prefix, sub_path).lstrip("/") - return os.path.join(self._base_url, path) + path = urllib.parse.urljoin(self._api_prefix, sub_path).lstrip("/") + return urllib.parse.urljoin(self._base_url, path) def _get_headers(self): return {"Authorization": f"Token {self._access_token}"}