tinybird 0.0.1.dev51__py3-none-any.whl → 0.0.1.dev52__py3-none-any.whl
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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/modules/login.py +26 -47
- {tinybird-0.0.1.dev51.dist-info → tinybird-0.0.1.dev52.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev51.dist-info → tinybird-0.0.1.dev52.dist-info}/RECORD +7 -7
- {tinybird-0.0.1.dev51.dist-info → tinybird-0.0.1.dev52.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev51.dist-info → tinybird-0.0.1.dev52.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev51.dist-info → tinybird-0.0.1.dev52.dist-info}/top_level.txt +0 -0
tinybird/tb/__cli__.py
CHANGED
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev52'
|
|
8
|
+
__revision__ = '089e219'
|
tinybird/tb/modules/login.py
CHANGED
|
@@ -34,35 +34,16 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
|
34
34
|
height: 100vh;
|
|
35
35
|
margin: 0;
|
|
36
36
|
}
|
|
37
|
-
.message {
|
|
38
|
-
background: white;
|
|
39
|
-
padding: 2rem 3rem;
|
|
40
|
-
border-radius: 8px;
|
|
41
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
42
|
-
text-align: center;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
align-items: center;
|
|
46
|
-
}
|
|
47
|
-
h1 {
|
|
48
|
-
color: #25283D;
|
|
49
|
-
font-size: 1.2rem;
|
|
50
|
-
margin: 0;
|
|
51
|
-
font-weight: 500;
|
|
52
|
-
}
|
|
53
37
|
</style>
|
|
54
38
|
</head>
|
|
55
39
|
<body>
|
|
56
|
-
<div class="message">
|
|
57
|
-
<h1>Authenticating...</h1>
|
|
58
|
-
</div>
|
|
59
40
|
<script>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
fetch('/?
|
|
41
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
42
|
+
const code = searchParams.get('code');
|
|
43
|
+
const workspace = searchParams.get('workspace');
|
|
44
|
+
fetch('/?code=' + code, {method: 'POST'})
|
|
64
45
|
.then(() => {
|
|
65
|
-
|
|
46
|
+
window.location.href = "https://cloud.tinybird.co/cli-login?workspace=" + workspace;
|
|
66
47
|
});
|
|
67
48
|
</script>
|
|
68
49
|
</body>
|
|
@@ -73,13 +54,13 @@ class AuthHandler(http.server.SimpleHTTPRequestHandler):
|
|
|
73
54
|
parsed_path = urllib.parse.urlparse(self.path)
|
|
74
55
|
query_params = urllib.parse.parse_qs(parsed_path.query)
|
|
75
56
|
|
|
76
|
-
if "
|
|
77
|
-
|
|
78
|
-
self.server.auth_callback(
|
|
57
|
+
if "code" in query_params:
|
|
58
|
+
code = query_params["code"][0]
|
|
59
|
+
self.server.auth_callback(code) # type: ignore
|
|
79
60
|
self.send_response(200)
|
|
80
61
|
self.end_headers()
|
|
81
62
|
else:
|
|
82
|
-
self.send_error(400, "Missing '
|
|
63
|
+
self.send_error(400, "Missing 'code' parameter")
|
|
83
64
|
|
|
84
65
|
self.server.shutdown()
|
|
85
66
|
|
|
@@ -112,12 +93,17 @@ def start_server(auth_callback):
|
|
|
112
93
|
"--host",
|
|
113
94
|
help="Set custom host if it's different than https://api.tinybird.co. See https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.",
|
|
114
95
|
)
|
|
96
|
+
@click.option(
|
|
97
|
+
"--auth-host",
|
|
98
|
+
default="https://cloud.tinybird.co",
|
|
99
|
+
help="Set the host to authenticate to. If unset, the default host will be used.",
|
|
100
|
+
)
|
|
115
101
|
@click.option(
|
|
116
102
|
"--workspace",
|
|
117
103
|
help="Set the workspace to authenticate to. If unset, the default workspace will be used.",
|
|
118
104
|
)
|
|
119
105
|
@coro
|
|
120
|
-
async def login(host: str, workspace: str):
|
|
106
|
+
async def login(host: str, auth_host: str, workspace: str):
|
|
121
107
|
"""Authenticate using the browser."""
|
|
122
108
|
auth_event = threading.Event()
|
|
123
109
|
auth_code = [None] # Using a list to store the code, as it's mutable
|
|
@@ -135,30 +121,23 @@ async def login(host: str, workspace: str):
|
|
|
135
121
|
server_thread.start()
|
|
136
122
|
|
|
137
123
|
# Open the browser to the auth page
|
|
138
|
-
if "wadus" in host:
|
|
139
|
-
client_id = "Rpl7Uy9aSjqoPCSvHgGl3zNQuZcSOXBe"
|
|
140
|
-
base_auth_url = "https://auth.wadus1.tinybird.co"
|
|
141
|
-
else:
|
|
142
|
-
client_id = "T6excMo8IKguvUw4vFNYfqlt9pe6msCU"
|
|
143
|
-
base_auth_url = "https://auth.tinybird.co"
|
|
144
124
|
callback_url = f"http://localhost:{AUTH_SERVER_PORT}"
|
|
145
125
|
params = {
|
|
146
|
-
"client_id": client_id,
|
|
147
126
|
"redirect_uri": callback_url,
|
|
148
|
-
"response_type": "token",
|
|
149
|
-
"scope": "openid profile email",
|
|
150
127
|
}
|
|
151
|
-
|
|
128
|
+
|
|
129
|
+
if workspace:
|
|
130
|
+
params["workspace"] = workspace
|
|
131
|
+
|
|
132
|
+
auth_url = f"{auth_host}/api/cli-login?{urlencode(params)}"
|
|
152
133
|
webbrowser.open(auth_url)
|
|
153
134
|
|
|
154
135
|
# Wait for the authentication to complete or timeout
|
|
155
136
|
if auth_event.wait(timeout=60): # Wait for up to 60 seconds
|
|
156
137
|
params = {}
|
|
157
|
-
|
|
158
|
-
params["workspace_id"] = workspace
|
|
138
|
+
params["code"] = auth_code[0]
|
|
159
139
|
response = requests.get( # noqa: ASYNC210
|
|
160
|
-
f"{
|
|
161
|
-
headers={"Authorization": f"Bearer {auth_code[0]}"},
|
|
140
|
+
f"{auth_host}/api/cli-login?{urlencode(params)}",
|
|
162
141
|
)
|
|
163
142
|
|
|
164
143
|
data = response.json()
|
|
@@ -168,15 +147,15 @@ async def login(host: str, workspace: str):
|
|
|
168
147
|
cli_config.set_user_token(data.get("user_token", ""))
|
|
169
148
|
cli_config.set_host(host)
|
|
170
149
|
|
|
171
|
-
ws = await cli_config.get_client().workspace_info()
|
|
150
|
+
ws = await cli_config.get_client(token=data.get("workspace_token", "")).workspace_info()
|
|
172
151
|
for k in ("id", "name", "user_email", "user_id", "scope"):
|
|
173
152
|
if k in ws:
|
|
174
153
|
cli_config[k] = ws[k]
|
|
175
154
|
|
|
176
155
|
cli_config.persist_to_file()
|
|
177
|
-
click.echo(FeedbackManager.
|
|
178
|
-
click.echo(FeedbackManager.
|
|
179
|
-
click.echo(FeedbackManager.
|
|
156
|
+
click.echo(FeedbackManager.gray(message="\nWorkspace: ") + FeedbackManager.info(message=ws["name"]))
|
|
157
|
+
click.echo(FeedbackManager.gray(message="User: ") + FeedbackManager.info(message=ws["user_email"]))
|
|
158
|
+
click.echo(FeedbackManager.gray(message="Host: ") + FeedbackManager.info(message=host))
|
|
180
159
|
click.echo(FeedbackManager.success(message="\n✓ Authentication successful!"))
|
|
181
160
|
else:
|
|
182
161
|
click.echo(FeedbackManager.error(message="Authentication failed or timed out."))
|
|
@@ -15,7 +15,7 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
|
|
|
15
15
|
tinybird/tornado_template.py,sha256=FL85SMPq2dH4JqKovmSbaolGdEzwOO91NqOzqXo2Qr0,41863
|
|
16
16
|
tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
|
|
17
17
|
tinybird/ch_utils/engine.py,sha256=OXkBhlzGjZotjD0vaT-rFIbSGV4tpiHxE8qO_ip0SyQ,40454
|
|
18
|
-
tinybird/tb/__cli__.py,sha256=
|
|
18
|
+
tinybird/tb/__cli__.py,sha256=IBx_XSP1q2ge9y0mmA6ZqDind5oGjb9jTywt-9A8TQU,251
|
|
19
19
|
tinybird/tb/cli.py,sha256=FD1pfbzu9YHJHEG6Vtn_EwPLTYhwqw-I6AxXeTaRHU8,926
|
|
20
20
|
tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
|
|
21
21
|
tinybird/tb/modules/build.py,sha256=bGx4sON9g90zVBVCd16La-1yV1nWZ_AY-2RZ77sco0s,8361
|
|
@@ -36,7 +36,7 @@ tinybird/tb/modules/llm.py,sha256=AC0VSphTOM2t-v1_3NLvNN_FIbgMo4dTyMqIv5nniPo,83
|
|
|
36
36
|
tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
|
|
37
37
|
tinybird/tb/modules/local.py,sha256=x4xuCGVkoa8KLYGZEJnFUP8HUkKX05Frp_djRVjVjTs,5669
|
|
38
38
|
tinybird/tb/modules/local_common.py,sha256=W1fEnB1vBQ4YC5U1PdA0w0g3cTV78bQ5R-lRxdDj5-Y,2868
|
|
39
|
-
tinybird/tb/modules/login.py,sha256=
|
|
39
|
+
tinybird/tb/modules/login.py,sha256=bzZ5HyG3lD1DvWFrSXZKVJVUxRNEnmd_wXLITJbyalg,5733
|
|
40
40
|
tinybird/tb/modules/materialization.py,sha256=HQKRTH6lkcYiDQJihbFqF_in58ezXG4ggZ_7Ywp_nUM,5738
|
|
41
41
|
tinybird/tb/modules/mock.py,sha256=PzFtZL-6bZAZ3EiCC2nYJo058I4m50fD7FcBHISn3cI,5235
|
|
42
42
|
tinybird/tb/modules/pipe.py,sha256=pH2KwgH6Xbvl3kT8vMelpKvT6bcyB4EKFDvGfOsxXbg,2418
|
|
@@ -74,8 +74,8 @@ tinybird/tb_cli_modules/config.py,sha256=6u6B5QCdiQLbJkCkwtnKGs9H3nP-KXXhC75mF7B
|
|
|
74
74
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
75
75
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
76
76
|
tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
|
|
77
|
-
tinybird-0.0.1.
|
|
78
|
-
tinybird-0.0.1.
|
|
79
|
-
tinybird-0.0.1.
|
|
80
|
-
tinybird-0.0.1.
|
|
81
|
-
tinybird-0.0.1.
|
|
77
|
+
tinybird-0.0.1.dev52.dist-info/METADATA,sha256=SiIvJoWFT3tstvtnBfuqv3v_tjkswAQ-z-wrB8J8UwA,2482
|
|
78
|
+
tinybird-0.0.1.dev52.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
79
|
+
tinybird-0.0.1.dev52.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
80
|
+
tinybird-0.0.1.dev52.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
81
|
+
tinybird-0.0.1.dev52.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|