oauth2-cli-auth 1.6.0__tar.gz → 1.6.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.
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/PKG-INFO +1 -1
- oauth2_cli_auth-1.6.2/oauth2_cli_auth/__version__.py +1 -0
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/_urllib_util.py +2 -1
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/code_grant.py +3 -2
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/http_server.py +2 -2
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/pyproject.toml +2 -2
- oauth2_cli_auth-1.6.0/oauth2_cli_auth/__version__.py +0 -1
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/LICENSE +0 -0
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/README.md +0 -0
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/__init__.py +0 -0
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/_timeout.py +0 -0
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/conftest.py +0 -0
- {oauth2_cli_auth-1.6.0 → oauth2_cli_auth-1.6.2}/oauth2_cli_auth/simplified_flow.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.6.2"
|
|
@@ -2,6 +2,7 @@ import json
|
|
|
2
2
|
import time
|
|
3
3
|
import urllib
|
|
4
4
|
from urllib.error import URLError
|
|
5
|
+
from typing import Union
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def _urlopen_with_backoff(url, max_retries=3, base_delay=1, timeout=15):
|
|
@@ -19,7 +20,7 @@ def _urlopen_with_backoff(url, max_retries=3, base_delay=1, timeout=15):
|
|
|
19
20
|
raise URLError(f"Failed to open URL after {max_retries} retries")
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
def _load_json(url_or_request: str
|
|
23
|
+
def _load_json(url_or_request: Union[str, urllib.request.Request]) -> dict:
|
|
23
24
|
with _urlopen_with_backoff(url_or_request) as response:
|
|
24
25
|
response_data = response.read().decode('utf-8')
|
|
25
26
|
json_response = json.loads(response_data)
|
|
@@ -7,6 +7,7 @@ import urllib.request
|
|
|
7
7
|
import webbrowser
|
|
8
8
|
from collections.abc import Callable
|
|
9
9
|
from dataclasses import dataclass
|
|
10
|
+
from typing import Optional
|
|
10
11
|
|
|
11
12
|
from oauth2_cli_auth._urllib_util import _load_json
|
|
12
13
|
|
|
@@ -58,7 +59,7 @@ def load_oidc_config(odic_well_known_endpoint: str) -> dict:
|
|
|
58
59
|
return config
|
|
59
60
|
|
|
60
61
|
|
|
61
|
-
def open_browser(url: str, print_open_browser_instruction: Callable[[str], None]
|
|
62
|
+
def open_browser(url: str, print_open_browser_instruction: Optional[Callable[[str], None]] = print) -> None:
|
|
62
63
|
"""
|
|
63
64
|
Open browser using webbrowser module and show message about URL open
|
|
64
65
|
|
|
@@ -82,7 +83,7 @@ def get_auth_url(client_info: OAuth2ClientInfo, redirect_uri: str) -> str:
|
|
|
82
83
|
return (f"{client_info.authorization_url}"
|
|
83
84
|
f"?client_id={client_info.client_id}"
|
|
84
85
|
f"&redirect_uri={redirect_uri}"
|
|
85
|
-
f"&scope={'
|
|
86
|
+
f"&scope={'+'.join(client_info.scopes)}"
|
|
86
87
|
f"&response_type=code")
|
|
87
88
|
|
|
88
89
|
|
|
@@ -234,9 +234,9 @@ class OAuthCallbackHttpServer(HTTPServer):
|
|
|
234
234
|
def __init__(self, port):
|
|
235
235
|
super().__init__(("", port), OAuthRedirectHandler)
|
|
236
236
|
|
|
237
|
-
self._code: str
|
|
237
|
+
self._code: Optional[str] = None
|
|
238
238
|
|
|
239
|
-
def get_code(self) -> str
|
|
239
|
+
def get_code(self) -> Optional[str]:
|
|
240
240
|
"""
|
|
241
241
|
This method should only be called after the request was done and might be None when no token is given.
|
|
242
242
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "oauth2-cli-auth"
|
|
3
|
-
version = "1.6.
|
|
3
|
+
version = "1.6.2"
|
|
4
4
|
description = "Authenticate against OAuth2 Provider in Python CLIs"
|
|
5
5
|
authors = ["Timo Reymann <mail@timo-reymann.de>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -39,7 +39,7 @@ priority="explicit"
|
|
|
39
39
|
[tool.poetry.group.dev.dependencies]
|
|
40
40
|
pytest = "^8.0.0"
|
|
41
41
|
coverage = "^7.3.2"
|
|
42
|
-
setuptools = "^
|
|
42
|
+
setuptools = "^78.0.0"
|
|
43
43
|
pydoctor = "^24.0.0"
|
|
44
44
|
|
|
45
45
|
[tool.coverage.run]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.6.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|