Skip to content

Commit 535f153

Browse files
authored
improve OAuthCredentials import ease of use (#732)
* improve OAuthCredentials import ease of use * improve OAuthCredentials import ease of use
1 parent a004bed commit 535f153

File tree

6 files changed

+38
-34
lines changed

6 files changed

+38
-34
lines changed

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: chartboost/ruff-action@v1
1717
with:
18-
version: 0.9.2
18+
version: 0.9.4
1919
- uses: chartboost/ruff-action@v1
2020
with:
21-
version: 0.9.2
21+
version: 0.9.4
2222
args: format --check
2323
mypy:
2424
runs-on: ubuntu-latest

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.9.2
4+
rev: v0.9.4
55
hooks:
66
# Run the linter.
77
- id: ruff
8+
args: [ --fix ]
89
# Run the formatter.
910
- id: ruff-format
1011

docs/source/setup/oauth.rst

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ You will also need to pass ``client_id`` and ``client_secret`` to :py:class:`YTM
2424

2525
.. code-block::
2626
27+
from ytmusicapi import YTMusic, OAuthCredentials
28+
2729
ytmusic = YTMusic('oauth.json', oauth_credentials=OAuthCredentials(client_id=client_id, client_secret=client_secret)
2830
2931
This OAuth flow uses the

docs/source/usage.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ After you have created the authentication JSON, you can instantiate the class:
2323

2424
.. code-block:: python
2525
26-
from ytmusicapi import YTMusic
26+
from ytmusicapi import YTMusic, OAuthCredentials
2727
ytmusic = YTMusic("browser.json") # or, alternatively
2828
ytmusic = YTMusic("oauth.json", oauth_credentials=OAuthCredentials(client_id=client_id, client_secret=client_secret)
2929

pdm.lock

+29-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ytmusicapi/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from importlib.metadata import PackageNotFoundError, version
22

3+
from ytmusicapi.auth.oauth.credentials import OAuthCredentials
34
from ytmusicapi.setup import setup, setup_oauth
45
from ytmusicapi.ytmusic import YTMusic
56

@@ -12,4 +13,4 @@
1213
__copyright__ = "Copyright 2024 sigma67"
1314
__license__ = "MIT"
1415
__title__ = "ytmusicapi"
15-
__all__ = ["YTMusic", "setup", "setup_oauth"]
16+
__all__ = ["OAuthCredentials", "YTMusic", "setup", "setup_oauth"]

0 commit comments

Comments
 (0)