Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve OAuthCredentials import ease of use #732

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
version: 0.9.2
version: 0.9.4
- uses: chartboost/ruff-action@v1
with:
version: 0.9.2
version: 0.9.4
args: format --check
mypy:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.2
rev: v0.9.4
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

Expand Down
2 changes: 2 additions & 0 deletions docs/source/setup/oauth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ You will also need to pass ``client_id`` and ``client_secret`` to :py:class:`YTM

.. code-block::

from ytmusicapi import YTMusic, OAuthCredentials

ytmusic = YTMusic('oauth.json', oauth_credentials=OAuthCredentials(client_id=client_id, client_secret=client_secret)

This OAuth flow uses the
Expand Down
2 changes: 1 addition & 1 deletion docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ After you have created the authentication JSON, you can instantiate the class:

.. code-block:: python

from ytmusicapi import YTMusic
from ytmusicapi import YTMusic, OAuthCredentials
ytmusic = YTMusic("browser.json") # or, alternatively
ytmusic = YTMusic("oauth.json", oauth_credentials=OAuthCredentials(client_id=client_id, client_secret=client_secret)

Expand Down
58 changes: 29 additions & 29 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ytmusicapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from importlib.metadata import PackageNotFoundError, version

from ytmusicapi.auth.oauth.credentials import OAuthCredentials
from ytmusicapi.setup import setup, setup_oauth
from ytmusicapi.ytmusic import YTMusic

Expand All @@ -12,4 +13,4 @@
__copyright__ = "Copyright 2024 sigma67"
__license__ = "MIT"
__title__ = "ytmusicapi"
__all__ = ["YTMusic", "setup", "setup_oauth"]
__all__ = ["OAuthCredentials", "YTMusic", "setup", "setup_oauth"]