ytmusicapi.auth package

Subpackages

Submodules

ytmusicapi.auth.auth_parse module

ytmusicapi.auth.auth_parse.determine_auth_type(auth_headers: requests.structures.CaseInsensitiveDict) ytmusicapi.auth.types.AuthType

Determine the type of auth based on auth headers.

Parameters:

auth_headers (CaseInsensitiveDict) – auth headers dict

Return type:

AuthType

Returns:

AuthType enum

ytmusicapi.auth.auth_parse.parse_auth_str(auth: str | dict) tuple[requests.structures.CaseInsensitiveDict, Optional[pathlib.Path]]
Parameters:

auth (Union[str, dict]) – user-provided auth string or dict

Return type:

tuple[CaseInsensitiveDict, Optional[Path]]

Returns:

parsed header dict based on auth, optionally path to file if it auth was a path to a file

ytmusicapi.auth.browser module

ytmusicapi.auth.browser.is_browser(headers: requests.structures.CaseInsensitiveDict) bool
Return type:

bool

ytmusicapi.auth.browser.setup_browser(filepath: str | None = None, headers_raw: str | None = None) str
Return type:

str

ytmusicapi.auth.types module

enum representing types of authentication supported by this library

class ytmusicapi.auth.types.AuthType(value)

Bases: int, Enum

enum representing types of authentication supported by this library

BROWSER = 2
OAUTH_CUSTOM_CLIENT = 3

YTM instance is using a non-default OAuth client (id & secret)

OAUTH_CUSTOM_FULL = 4

allows fully formed OAuth headers to ignore browser auth refresh flow

UNAUTHORIZED = 1

Module contents