Skip to content

Commit

Permalink
Add path to both v1 and v2 api's
Browse files Browse the repository at this point in the history
  • Loading branch information
tehkillerbee committed Jan 26, 2024
1 parent 888e1c4 commit 60027f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tidalapi/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def basic_request(
headers["authorization"] = (
self.session.token_type + " " + self.session.access_token
)
url = urljoin(self.session.config.api_location, path)
url = urljoin(self.session.config.api_v1_location, path)
request = self.session.request_session.request(
method, url, params=request_params, data=data, headers=headers
)
Expand Down
6 changes: 4 additions & 2 deletions tidalapi/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import random
import time
import uuid
import locale
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -94,7 +95,8 @@ class Config:
Additionally, num_videos will turn into num_tracks in playlists.
"""

api_location: str = "https://api.tidal.com/v1/"
api_v1_location: str = "https://api.tidal.com/v1/"
api_v2_location: str = "https://api.tidal.com/v2/"
api_token: str
client_id: str
client_secret: str
Expand Down Expand Up @@ -382,7 +384,7 @@ def login(self, username: str, password: str) -> bool:
:param password: The password to your TIDAL account
:return: Returns true if we think the login was successful.
"""
url = urljoin(self.config.api_location, "login/username")
url = urljoin(self.config.api_v1_location, "login/username")
headers: dict[str, str] = {"X-Tidal-Token": self.config.api_token}
payload = {
"username": username,
Expand Down

0 comments on commit 60027f3

Please sign in to comment.