deezer-oauth-cli 1.5.1__tar.gz → 1.6.0__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.
Files changed (27) hide show
  1. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/PKG-INFO +12 -5
  2. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/README.md +7 -0
  3. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/pyproject.toml +8 -7
  4. deezer_oauth_cli-1.6.0/src/deezer_oauth/__init__.py +1 -0
  5. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/main.py +4 -4
  6. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/server.py +1 -3
  7. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth_cli.egg-info/PKG-INFO +12 -5
  8. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth_cli.egg-info/SOURCES.txt +0 -1
  9. deezer_oauth_cli-1.6.0/tests/test_main.py +42 -0
  10. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/tests/test_server.py +1 -6
  11. deezer_oauth_cli-1.5.1/setup.py +0 -9
  12. deezer_oauth_cli-1.5.1/src/deezer_oauth/__init__.py +0 -1
  13. deezer_oauth_cli-1.5.1/tests/test_main.py +0 -18
  14. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/LICENSE +0 -0
  15. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/setup.cfg +0 -0
  16. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/__main__.py +0 -0
  17. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/client.py +0 -0
  18. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/constants.py +0 -0
  19. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/files.py +0 -0
  20. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth/py.typed +0 -0
  21. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth_cli.egg-info/dependency_links.txt +0 -0
  22. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth_cli.egg-info/entry_points.txt +0 -0
  23. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth_cli.egg-info/requires.txt +0 -0
  24. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/src/deezer_oauth_cli.egg-info/top_level.txt +0 -0
  25. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/tests/test_client.py +0 -0
  26. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/tests/test_dunder_main.py +0 -0
  27. {deezer_oauth_cli-1.5.1 → deezer_oauth_cli-1.6.0}/tests/test_files.py +0 -0
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: deezer-oauth-cli
3
- Version: 1.5.1
3
+ Version: 1.6.0
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
@@ -15,18 +15,18 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
21
  Classifier: Programming Language :: Python :: 3.13
23
22
  Classifier: Topic :: Software Development :: Libraries
24
- Requires-Python: >=3.9
23
+ Requires-Python: >=3.10
25
24
  Description-Content-Type: text/markdown
26
25
  License-File: LICENSE
27
26
  Requires-Dist: httpx>=0.27
28
27
  Requires-Dist: rich>=10
29
28
  Requires-Dist: typer>=0.12
29
+ Dynamic: license-file
30
30
 
31
31
  # Deezer OAuth CLI
32
32
 
@@ -79,6 +79,13 @@ Install this via pip (or your favourite package manager):
79
79
 
80
80
  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
81
 
82
+ > **Important note**
83
+ >
84
+ > **At the moment, it is not possible to register a new application via the Deezer Developer Portal.**
85
+ >
86
+ > The portal currently displays the message:
87
+ > **"We're not accepting new application creation at this time. Please check again later."**
88
+
82
89
  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
90
 
84
91
  ```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,24 +1,23 @@
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.1"
7
+ version = "1.6.0"
8
8
  description = "A small CLI to quickly obtain an API token for Deezer API."
9
9
  readme = "README.md"
10
- license = { text = "MIT" }
10
+ license = "MIT"
11
11
  authors = [
12
12
  { name = "Bruno Alla", email = "alla.brunoo@gmail.com" },
13
13
  ]
14
- requires-python = ">=3.9"
14
+ requires-python = ">=3.10"
15
15
  classifiers = [
16
16
  "Development Status :: 2 - Pre-Alpha",
17
17
  "Intended Audience :: Developers",
18
18
  "Natural Language :: English",
19
19
  "Operating System :: OS Independent",
20
20
  "Programming Language :: Python :: 3 :: Only",
21
- "Programming Language :: Python :: 3.9",
22
21
  "Programming Language :: Python :: 3.10",
23
22
  "Programming Language :: Python :: 3.11",
24
23
  "Programming Language :: Python :: 3.12",
@@ -43,13 +42,12 @@ scripts.deezer-oauth = "deezer_oauth.main:app"
43
42
  dev = [
44
43
  "pyfakefs>=5,<6",
45
44
  "pytest>=8,<9",
46
- "pytest-cov>=6,<7",
45
+ "pytest-cov>=7,<8",
47
46
  "pytest-mock>=3.6,<4",
48
47
  "respx>=0.22",
49
48
  ]
50
49
 
51
50
  [tool.ruff]
52
- target-version = "py39"
53
51
  line-length = 88
54
52
 
55
53
  lint.select = [
@@ -83,6 +81,9 @@ lint.per-file-ignores."tests/**/*" = [
83
81
  ]
84
82
  lint.isort.known-first-party = [ "deezer_oauth", "tests" ]
85
83
 
84
+ [tool.pyproject-fmt]
85
+ max_supported_python = "3.13"
86
+
86
87
  [tool.pytest.ini_options]
87
88
  addopts = "-v -Wdefault --cov=deezer_oauth --cov-report=term-missing:skip-covered"
88
89
  pythonpath = [ "src" ]
@@ -0,0 +1 @@
1
+ __version__ = "1.6.0"
@@ -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
- Obtain an API token from Deezer.
19
+ Get an API token from Deezer.
20
20
 
21
- This script spins up a basic HTTP server, perform the OAuth flow to generate
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 give as parameter here.
27
+ This will give you an application ID a secret key to pass as arguments.
28
28
  """
29
- # Commence OAuth flow
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
1
+ Metadata-Version: 2.4
2
2
  Name: deezer-oauth-cli
3
- Version: 1.5.1
3
+ Version: 1.6.0
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
@@ -15,18 +15,18 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.9
19
18
  Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
21
  Classifier: Programming Language :: Python :: 3.13
23
22
  Classifier: Topic :: Software Development :: Libraries
24
- Requires-Python: >=3.9
23
+ Requires-Python: >=3.10
25
24
  Description-Content-Type: text/markdown
26
25
  License-File: LICENSE
27
26
  Requires-Dist: httpx>=0.27
28
27
  Requires-Dist: rich>=10
29
28
  Requires-Dist: typer>=0.12
29
+ Dynamic: license-file
30
30
 
31
31
  # Deezer OAuth CLI
32
32
 
@@ -79,6 +79,13 @@ Install this via pip (or your favourite package manager):
79
79
 
80
80
  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
81
 
82
+ > **Important note**
83
+ >
84
+ > **At the moment, it is not possible to register a new application via the Deezer Developer Portal.**
85
+ >
86
+ > The portal currently displays the message:
87
+ > **"We're not accepting new application creation at this time. Please check again later."**
88
+
82
89
  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
90
 
84
91
  ```shell
@@ -1,7 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- setup.py
5
4
  src/deezer_oauth/__init__.py
6
5
  src/deezer_oauth/__main__.py
7
6
  src/deezer_oauth/client.py
@@ -0,0 +1,42 @@
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.stderr
12
+ assert "Missing argument 'APP_ID'." in result.stderr
13
+
14
+
15
+ def test_help():
16
+ result = runner.invoke(app, ["--help"])
17
+ assert result.exit_code == 0
18
+ assert "Get an API token from Deezer." in result.stdout
19
+
20
+
21
+ def test_main_flow(mocker):
22
+ """Test the main OAuth flow execution."""
23
+ mock_dancer = mocker.MagicMock()
24
+ mock_dancer.get_auth_page.return_value = "https://example.com/oauth"
25
+
26
+ mock_oauth_dancer = mocker.patch(
27
+ "deezer_oauth.main.OAuthDancer", return_value=mock_dancer
28
+ )
29
+ mock_webbrowser = mocker.patch("deezer_oauth.main.webbrowser.open")
30
+ mock_run_server = mocker.patch("deezer_oauth.main.run_server")
31
+
32
+ result = runner.invoke(app, ["test-id", "test-secret"])
33
+
34
+ assert result.exit_code == 0
35
+ assert "Opening https://example.com/oauth in web browser..." in result.stdout
36
+
37
+ mock_oauth_dancer.assert_called_once_with(
38
+ app_id="test-id",
39
+ app_secret="test-secret", # noqa: S106
40
+ )
41
+ mock_webbrowser.assert_called_once_with("https://example.com/oauth")
42
+ mock_run_server.assert_called_once_with(mock_dancer)
@@ -1,13 +1,8 @@
1
1
  import http.client
2
- import sys
3
2
  import threading
4
3
 
5
- if sys.version_info < (3, 10):
6
- from test.support import threading_cleanup, threading_setup
7
- else:
8
- from test.support.threading_helper import threading_cleanup, threading_setup
9
-
10
4
  import pytest
5
+ from test.support.threading_helper import threading_cleanup, threading_setup
11
6
 
12
7
  from deezer_oauth.client import OAuthDancer
13
8
  from deezer_oauth.server import LocalHTTPServer, LocalRequestHandler, run_server
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- # This is a shim to allow GitHub to detect the package, build is done with poetry
4
- # Taken from https://github.com/Textualize/rich
5
-
6
- import setuptools
7
-
8
- if __name__ == "__main__":
9
- setuptools.setup(name="deezer-oauth-cli")
@@ -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