Merge pull request #155 from LucasLeRay/add-alternate-identifier-task

Add alternate identifier login task
Этот коммит содержится в:
vladkens 2024-04-16 22:19:25 +03:00 коммит произвёл GitHub
родитель 00a8e07b43 21ed2a0228
Коммит e15fee3964
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194

Просмотреть файл

@ -47,6 +47,22 @@ async def login_initiate(client: AsyncClient) -> Response:
return rep
async def login_alternate_identifier(ctx: TaskCtx, *, username: str) -> Response:
payload = {
"flow_token": ctx.prev["flow_token"],
"subtask_inputs": [
{
"subtask_id": "LoginEnterAlternateIdentifierSubtask",
"enter_text": {"text": username, "link": "next_link"},
}
],
}
rep = await ctx.client.post(LOGIN_URL, json=payload)
raise_for_status(rep, "login_alternate_identifier")
return rep
async def login_instrumentation(ctx: TaskCtx) -> Response:
payload = {
"flow_token": ctx.prev["flow_token"],
@ -200,6 +216,8 @@ async def next_login_task(ctx: TaskCtx, rep: Response):
return await login_enter_username(ctx)
if task_id == "LoginJsInstrumentationSubtask":
return await login_instrumentation(ctx)
if task_id == "LoginEnterAlternateIdentifierSubtask":
return await login_alternate_identifier(ctx, username=ctx.acc.username)
except Exception as e:
ctx.acc.error_msg = f"login_step={task_id} err={e}"
raise e