doploy-cli 0.2.5__tar.gz → 0.2.6__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.
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/PKG-INFO +1 -1
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli/main.py +13 -9
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli.egg-info/PKG-INFO +1 -1
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/pyproject.toml +1 -1
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/LICENSE +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/README.md +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli/SKILL.md +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli/__init__.py +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli.egg-info/SOURCES.txt +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli.egg-info/dependency_links.txt +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli.egg-info/entry_points.txt +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli.egg-info/requires.txt +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/doploy_cli.egg-info/top_level.txt +0 -0
- {doploy_cli-0.2.5 → doploy_cli-0.2.6}/setup.cfg +0 -0
|
@@ -183,8 +183,12 @@ def _free_port() -> int:
|
|
|
183
183
|
return s.getsockname()[1]
|
|
184
184
|
|
|
185
185
|
|
|
186
|
-
def _wait_for_callback(port: int, state: str, timeout: float = 300.0) -> str:
|
|
187
|
-
"""Serve one loopback request and return the OAuth `code` it carried.
|
|
186
|
+
def _wait_for_callback(port: int, state: str, done_url: str, timeout: float = 300.0) -> str:
|
|
187
|
+
"""Serve one loopback request and return the OAuth `code` it carried.
|
|
188
|
+
|
|
189
|
+
The browser is sent on to ``done_url?status=...`` (a branded page hosted by
|
|
190
|
+
the doploy server) rather than shown bare text from this loopback server.
|
|
191
|
+
"""
|
|
188
192
|
from urllib.parse import parse_qs, urlparse
|
|
189
193
|
result: dict = {}
|
|
190
194
|
|
|
@@ -192,15 +196,15 @@ def _wait_for_callback(port: int, state: str, timeout: float = 300.0) -> str:
|
|
|
192
196
|
def do_GET(self): # noqa: N802
|
|
193
197
|
q = parse_qs(urlparse(self.path).query)
|
|
194
198
|
if q.get('state', [''])[0] != state:
|
|
195
|
-
|
|
199
|
+
status, result['error'] = 'error', 'state mismatch'
|
|
196
200
|
elif q.get('error'):
|
|
197
|
-
|
|
201
|
+
status, result['error'] = 'cancelled', q['error'][0]
|
|
198
202
|
else:
|
|
199
|
-
|
|
200
|
-
self.send_response(
|
|
201
|
-
self.send_header('
|
|
203
|
+
status, result['code'] = 'ok', q.get('code', [''])[0]
|
|
204
|
+
self.send_response(302)
|
|
205
|
+
self.send_header('Location', f'{done_url}?status={status}')
|
|
206
|
+
self.send_header('Content-Length', '0')
|
|
202
207
|
self.end_headers()
|
|
203
|
-
self.wfile.write(f'<html><body style="font-family:sans-serif"><p>{body}</p></body></html>'.encode())
|
|
204
208
|
|
|
205
209
|
def log_message(self, *a): # silence
|
|
206
210
|
pass
|
|
@@ -241,7 +245,7 @@ def _browser_login(base: str) -> None:
|
|
|
241
245
|
print('Opening your browser to sign in to doploy. If it does not open, visit:')
|
|
242
246
|
print(f' {url}')
|
|
243
247
|
webbrowser.open(url)
|
|
244
|
-
code = _wait_for_callback(port, state)
|
|
248
|
+
code = _wait_for_callback(port, state, f'{issuer}/cli/complete')
|
|
245
249
|
|
|
246
250
|
tok = _oauth_token_request(base, {
|
|
247
251
|
'grant_type': 'authorization_code', 'code': code, 'redirect_uri': redirect_uri,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|