Skip to content

Commit

Permalink
improve OAuthCredentials import ease of use (#732)
Browse files Browse the repository at this point in the history
* improve OAuthCredentials import ease of use

* improve OAuthCredentials import ease of use
  • Loading branch information
sigma67 authored Jan 31, 2025
1 parent a004bed commit 535f153
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 34 deletions.
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"]

0 comments on commit 535f153

Please sign in to comment.