Skip to content

Commit

Permalink
fix: use urllib to join url paths, fixes library for windows machines
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Vetter committed Sep 6, 2022
1 parent 33fe166 commit 4183657
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions push_to_3yourmind/api/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Base classes
"""
import os
import typing as t
import urllib

import requests

Expand All @@ -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

Expand All @@ -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}"}
Expand Down

0 comments on commit 4183657

Please sign in to comment.