Skip to content

Commit b9ee67b

Browse files
committed
fix uri
1 parent 7cbd647 commit b9ee67b

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/kernelbot/api/api_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ async def _handle_discord_oauth(code: str, redirect_uri: str) -> tuple[str, str]
4242
"redirect_uri": redirect_uri,
4343
}
4444

45-
print(token_data)
46-
print(token_url)
47-
4845
try:
4946
token_response = requests.post(token_url, data=token_data)
5047
token_response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)

src/kernelbot/api/main.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,11 @@ async def cli_auth(auth_provider: str, code: str, state: str, db_context=Depends
264264
"Set DISCORD_CLUSTER_MANAGER_API_BASE_URL or POPCORN_API_URL.",
265265
)
266266
redirect_uri_base = api_base_url.rstrip("/")
267-
redirect_uri = f"https://{redirect_uri_base}/auth/cli/{auth_provider}"
267+
redirect_uri = f"{redirect_uri_base}/auth/cli/{auth_provider}"
268268

269269
user_id = None
270270
user_name = None
271271

272-
print(redirect_uri)
273-
274272
try:
275273
if auth_provider == "discord":
276274
user_id, user_name = await _handle_discord_oauth(code, redirect_uri)
@@ -333,18 +331,24 @@ async def _stream_submission_response(
333331

334332
while not task.done():
335333
elapsed_time = time.time() - start_time
336-
yield f"event: status\ndata: {json.dumps({'status': 'processing',
337-
'elapsed_time': round(elapsed_time, 2)},
338-
default=json_serializer)}\n\n"
334+
yield f"event: status\ndata: {
335+
json.dumps(
336+
{'status': 'processing', 'elapsed_time': round(elapsed_time, 2)},
337+
default=json_serializer,
338+
)
339+
}\n\n"
339340

340341
try:
341342
await asyncio.wait_for(asyncio.shield(task), timeout=15.0)
342343
except asyncio.TimeoutError:
343344
continue
344345
except asyncio.CancelledError:
345-
yield f"event: error\ndata: {json.dumps(
346-
{'status': 'error', 'detail': 'Submission cancelled'},
347-
default=json_serializer)}\n\n"
346+
yield f"event: error\ndata: {
347+
json.dumps(
348+
{'status': 'error', 'detail': 'Submission cancelled'},
349+
default=json_serializer,
350+
)
351+
}\n\n"
348352
return
349353

350354
result, reports = await task

0 commit comments

Comments
 (0)