deezer-oauth-cli 1.5.1__tar.gz → 1.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/PKG-INFO +11 -3
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/README.md +7 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/pyproject.toml +3 -4
- deezer_oauth_cli-1.5.2/src/deezer_oauth/__init__.py +1 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/main.py +4 -4
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/server.py +1 -3
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/PKG-INFO +11 -3
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/SOURCES.txt +0 -1
- deezer_oauth_cli-1.5.2/tests/test_main.py +50 -0
- deezer_oauth_cli-1.5.1/setup.py +0 -9
- deezer_oauth_cli-1.5.1/src/deezer_oauth/__init__.py +0 -1
- deezer_oauth_cli-1.5.1/tests/test_main.py +0 -18
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/LICENSE +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/setup.cfg +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/__main__.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/client.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/constants.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/files.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth/py.typed +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/dependency_links.txt +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/entry_points.txt +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/requires.txt +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/top_level.txt +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/tests/test_client.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/tests/test_dunder_main.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/tests/test_files.py +0 -0
- {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/tests/test_server.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: deezer-oauth-cli
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.2
|
|
4
4
|
Summary: A small CLI to quickly obtain an API token for Deezer API.
|
|
5
5
|
Author-email: Bruno Alla <alla.brunoo@gmail.com>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/browniebroke/deezer-oauth-cli/issues
|
|
8
8
|
Project-URL: Changelog, https://github.com/browniebroke/deezer-oauth-cli/blob/main/CHANGELOG.md
|
|
9
9
|
Project-URL: documentation, https://github.com/browniebroke/deezer-oauth-cli/blob/main/README.md
|
|
@@ -27,6 +27,7 @@ License-File: LICENSE
|
|
|
27
27
|
Requires-Dist: httpx>=0.27
|
|
28
28
|
Requires-Dist: rich>=10
|
|
29
29
|
Requires-Dist: typer>=0.12
|
|
30
|
+
Dynamic: license-file
|
|
30
31
|
|
|
31
32
|
# Deezer OAuth CLI
|
|
32
33
|
|
|
@@ -79,6 +80,13 @@ Install this via pip (or your favourite package manager):
|
|
|
79
80
|
|
|
80
81
|
Before starting to use this tool, you first need to declare your Deezer app in [their developer portal](https://developers.deezer.com). Create a new app with the following Redirect URL: `http://localhost:8080/oauth/return`.
|
|
81
82
|
|
|
83
|
+
> **Important note**
|
|
84
|
+
>
|
|
85
|
+
> **At the moment, it is not possible to register a new application via the Deezer Developer Portal.**
|
|
86
|
+
>
|
|
87
|
+
> The portal currently displays the message:
|
|
88
|
+
> **"We're not accepting new application creation at this time. Please check again later."**
|
|
89
|
+
|
|
82
90
|
Once created, Deezer will generate an application ID and secret key for you, that's the 2 parameters that you need to run this tool:
|
|
83
91
|
|
|
84
92
|
```shell
|
|
@@ -49,6 +49,13 @@ Install this via pip (or your favourite package manager):
|
|
|
49
49
|
|
|
50
50
|
Before starting to use this tool, you first need to declare your Deezer app in [their developer portal](https://developers.deezer.com). Create a new app with the following Redirect URL: `http://localhost:8080/oauth/return`.
|
|
51
51
|
|
|
52
|
+
> **Important note**
|
|
53
|
+
>
|
|
54
|
+
> **At the moment, it is not possible to register a new application via the Deezer Developer Portal.**
|
|
55
|
+
>
|
|
56
|
+
> The portal currently displays the message:
|
|
57
|
+
> **"We're not accepting new application creation at this time. Please check again later."**
|
|
58
|
+
|
|
52
59
|
Once created, Deezer will generate an application ID and secret key for you, that's the 2 parameters that you need to run this tool:
|
|
53
60
|
|
|
54
61
|
```shell
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
build-backend = "setuptools.build_meta"
|
|
3
|
-
requires = [ "setuptools" ]
|
|
3
|
+
requires = [ "setuptools>=77.0.3" ]
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deezer-oauth-cli"
|
|
7
|
-
version = "1.5.
|
|
7
|
+
version = "1.5.2"
|
|
8
8
|
description = "A small CLI to quickly obtain an API token for Deezer API."
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
license =
|
|
10
|
+
license = "MIT"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "Bruno Alla", email = "alla.brunoo@gmail.com" },
|
|
13
13
|
]
|
|
@@ -49,7 +49,6 @@ dev = [
|
|
|
49
49
|
]
|
|
50
50
|
|
|
51
51
|
[tool.ruff]
|
|
52
|
-
target-version = "py39"
|
|
53
52
|
line-length = 88
|
|
54
53
|
|
|
55
54
|
lint.select = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.5.2"
|
|
@@ -16,17 +16,17 @@ app = typer.Typer()
|
|
|
16
16
|
@app.command()
|
|
17
17
|
def main(app_id: str, app_secret: str) -> None:
|
|
18
18
|
"""
|
|
19
|
-
|
|
19
|
+
Get an API token from Deezer.
|
|
20
20
|
|
|
21
|
-
This script spins up a basic HTTP server,
|
|
21
|
+
This script spins up a basic HTTP server, performs the OAuth flow to generate
|
|
22
22
|
an API token and write it to an .env file in the local directory.
|
|
23
23
|
|
|
24
24
|
You should log in/signup at https://developers.deezer.com/ and create an app
|
|
25
25
|
with a redirect URL of 'http://localhost:8080/oauth/return'.
|
|
26
26
|
|
|
27
|
-
This will give you an application ID a secret key to
|
|
27
|
+
This will give you an application ID a secret key to pass as arguments.
|
|
28
28
|
"""
|
|
29
|
-
#
|
|
29
|
+
# Begin OAuth flow
|
|
30
30
|
oauth_dancer = OAuthDancer(app_id=app_id, app_secret=app_secret)
|
|
31
31
|
start_url = oauth_dancer.get_auth_page()
|
|
32
32
|
print(f"Opening {start_url} in web browser...")
|
|
@@ -86,9 +86,7 @@ class LocalRequestHandler(BaseHTTPRequestHandler):
|
|
|
86
86
|
query_params = dict(parse_qsl(path_bits[1]))
|
|
87
87
|
token_data = self.oauth_dancer.get_token(query_params["code"])
|
|
88
88
|
content = (
|
|
89
|
-
f"Token: {token_data['access_token']}"
|
|
90
|
-
"<br>"
|
|
91
|
-
f"Expires: {token_data['expires']}"
|
|
89
|
+
f"Token: {token_data['access_token']}<br>Expires: {token_data['expires']}"
|
|
92
90
|
)
|
|
93
91
|
self._render_content(content)
|
|
94
92
|
write_env_file(token_data["access_token"])
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: deezer-oauth-cli
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.2
|
|
4
4
|
Summary: A small CLI to quickly obtain an API token for Deezer API.
|
|
5
5
|
Author-email: Bruno Alla <alla.brunoo@gmail.com>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/browniebroke/deezer-oauth-cli/issues
|
|
8
8
|
Project-URL: Changelog, https://github.com/browniebroke/deezer-oauth-cli/blob/main/CHANGELOG.md
|
|
9
9
|
Project-URL: documentation, https://github.com/browniebroke/deezer-oauth-cli/blob/main/README.md
|
|
@@ -27,6 +27,7 @@ License-File: LICENSE
|
|
|
27
27
|
Requires-Dist: httpx>=0.27
|
|
28
28
|
Requires-Dist: rich>=10
|
|
29
29
|
Requires-Dist: typer>=0.12
|
|
30
|
+
Dynamic: license-file
|
|
30
31
|
|
|
31
32
|
# Deezer OAuth CLI
|
|
32
33
|
|
|
@@ -79,6 +80,13 @@ Install this via pip (or your favourite package manager):
|
|
|
79
80
|
|
|
80
81
|
Before starting to use this tool, you first need to declare your Deezer app in [their developer portal](https://developers.deezer.com). Create a new app with the following Redirect URL: `http://localhost:8080/oauth/return`.
|
|
81
82
|
|
|
83
|
+
> **Important note**
|
|
84
|
+
>
|
|
85
|
+
> **At the moment, it is not possible to register a new application via the Deezer Developer Portal.**
|
|
86
|
+
>
|
|
87
|
+
> The portal currently displays the message:
|
|
88
|
+
> **"We're not accepting new application creation at this time. Please check again later."**
|
|
89
|
+
|
|
82
90
|
Once created, Deezer will generate an application ID and secret key for you, that's the 2 parameters that you need to run this tool:
|
|
83
91
|
|
|
84
92
|
```shell
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from typer.testing import CliRunner
|
|
3
|
+
|
|
4
|
+
from deezer_oauth.main import app
|
|
5
|
+
|
|
6
|
+
_CLI_RUNNER_KWARGS = {}
|
|
7
|
+
# if click < 8.2.0, add mix_stderr=False to its
|
|
8
|
+
# kwargs to opt-in to new behaviour
|
|
9
|
+
# We should be able to drop this when we drop Python 3.9
|
|
10
|
+
if click.__version__ < "8.2.0":
|
|
11
|
+
_CLI_RUNNER_KWARGS["mix_stderr"] = False
|
|
12
|
+
|
|
13
|
+
runner = CliRunner(**_CLI_RUNNER_KWARGS)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_no_arguments():
|
|
17
|
+
result = runner.invoke(app)
|
|
18
|
+
assert result.exit_code == 2
|
|
19
|
+
assert "Error" in result.stderr
|
|
20
|
+
assert "Missing argument 'APP_ID'." in result.stderr
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_help():
|
|
24
|
+
result = runner.invoke(app, ["--help"])
|
|
25
|
+
assert result.exit_code == 0
|
|
26
|
+
assert "Get an API token from Deezer." in result.stdout
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_main_flow(mocker):
|
|
30
|
+
"""Test the main OAuth flow execution."""
|
|
31
|
+
mock_dancer = mocker.MagicMock()
|
|
32
|
+
mock_dancer.get_auth_page.return_value = "https://example.com/oauth"
|
|
33
|
+
|
|
34
|
+
mock_oauth_dancer = mocker.patch(
|
|
35
|
+
"deezer_oauth.main.OAuthDancer", return_value=mock_dancer
|
|
36
|
+
)
|
|
37
|
+
mock_webbrowser = mocker.patch("deezer_oauth.main.webbrowser.open")
|
|
38
|
+
mock_run_server = mocker.patch("deezer_oauth.main.run_server")
|
|
39
|
+
|
|
40
|
+
result = runner.invoke(app, ["test-id", "test-secret"])
|
|
41
|
+
|
|
42
|
+
assert result.exit_code == 0
|
|
43
|
+
assert "Opening https://example.com/oauth in web browser..." in result.stdout
|
|
44
|
+
|
|
45
|
+
mock_oauth_dancer.assert_called_once_with(
|
|
46
|
+
app_id="test-id",
|
|
47
|
+
app_secret="test-secret", # noqa: S106
|
|
48
|
+
)
|
|
49
|
+
mock_webbrowser.assert_called_once_with("https://example.com/oauth")
|
|
50
|
+
mock_run_server.assert_called_once_with(mock_dancer)
|
deezer_oauth_cli-1.5.1/setup.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.5.1"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from typer.testing import CliRunner
|
|
2
|
-
|
|
3
|
-
from deezer_oauth.main import app
|
|
4
|
-
|
|
5
|
-
runner = CliRunner()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_no_arguments():
|
|
9
|
-
result = runner.invoke(app)
|
|
10
|
-
assert result.exit_code == 2
|
|
11
|
-
assert "Error" in result.stdout
|
|
12
|
-
assert "Missing argument 'APP_ID'." in result.stdout
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def test_help():
|
|
16
|
-
result = runner.invoke(app, ["--help"])
|
|
17
|
-
assert result.exit_code == 0
|
|
18
|
-
assert "Obtain an API token from Deezer." in result.stdout
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/requires.txt
RENAMED
|
File without changes
|
{deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.5.2}/src/deezer_oauth_cli.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|