Add optional parameters for OAuth client ID and secret to setup (#688)
* Add optional parameters for OAuth client ID and secret to setup Use your own Google API client ID and client secret in setup by calling ytmusicapi oauth --client_id <your Google API client ID> --client_secret <your Google API client secret> to avoid HTTP 400: Bad Request errors * Improve setup parameter parsing and help texts - Add subparsers for parameters for oauth and browser tokens - Add help options - Add a check for presence of both client_id and client_secret if oauth is chosen. * ruff autofix * wip: remove default oauth_client_id & secret, turn into mandatory params * fix yt_oauth fixture * fix format/lint * fix cli args and oauth test * remove skip --------- Co-authored-by: sigma67 <sigma67.github@gmail.com>
This commit is contained in:
parent
7ef703c213
commit
fe95f5974e
8 changed files with 59 additions and 34 deletions
|
|
@ -4,6 +4,7 @@ from pathlib import Path
|
|||
import pytest
|
||||
|
||||
from ytmusicapi import YTMusic
|
||||
from ytmusicapi.auth.oauth import OAuthCredentials
|
||||
|
||||
|
||||
def get_resource(file: str) -> str:
|
||||
|
|
@ -56,8 +57,11 @@ def fixture_yt_auth(browser_filepath) -> YTMusic:
|
|||
|
||||
|
||||
@pytest.fixture(name="yt_oauth")
|
||||
def fixture_yt_oauth(oauth_filepath) -> YTMusic:
|
||||
return YTMusic(oauth_filepath)
|
||||
def fixture_yt_oauth(oauth_filepath, config) -> YTMusic:
|
||||
credentials = OAuthCredentials(
|
||||
client_id=config["auth"]["client_id"], client_secret=config["auth"]["client_secret"]
|
||||
)
|
||||
return YTMusic(oauth_filepath, oauth_credentials=credentials)
|
||||
|
||||
|
||||
@pytest.fixture(name="yt_brand")
|
||||
|
|
|
|||
Loading…
Reference in a new issue