mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-14 01:06:43 +09:00
[Refactor] 파일 구조 변경
This commit is contained in:
parent
b7e6afb227
commit
26b40e0e65
3 changed files with 2 additions and 2 deletions
41
lib/agents/get_sso_list.py
Normal file
41
lib/agents/get_sso_list.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import json
|
||||
from pydantic import BaseModel
|
||||
from lib.prompt.get_sso_list import get_sso_list_task
|
||||
|
||||
from lib.browser_use_utils.run_task import run_task
|
||||
|
||||
|
||||
NOT_FOUND_LOGIN_PAGE = 0
|
||||
FOUND_LOGIN_PAGE = 1
|
||||
|
||||
class FindLoginPageResponse(BaseModel):
|
||||
status: int = NOT_FOUND_LOGIN_PAGE # 0 if not found, 1 if found
|
||||
msg: str | None = None
|
||||
url: str | None = None
|
||||
sso_list: list[str] = [] # List of SSO providers found on the login page
|
||||
|
||||
async def get_sso_list(target_url) -> tuple[bool, str | FindLoginPageResponse | None]:
|
||||
|
||||
task = get_sso_list_task
|
||||
ReturnModel = FindLoginPageResponse
|
||||
success, response = await run_task(target_url, ReturnModel, task)
|
||||
if not success:
|
||||
return False, response
|
||||
if isinstance(response, str):
|
||||
return False, response
|
||||
if isinstance(response, FindLoginPageResponse):
|
||||
if response.status == FOUND_LOGIN_PAGE:
|
||||
if not response.sso_list:
|
||||
response.msg = "로그인 페이지는 찾았지만 SSO 제공자가 없습니다."
|
||||
else:
|
||||
response.msg = "로그인 페이지와 SSO 제공자를 찾았습니다."
|
||||
else:
|
||||
response.msg = "로그인 페이지를 찾지 못했습니다."
|
||||
else:
|
||||
return False, "응답 형식이 올바르지 않습니다. FindLoginPageResponse가 아닙니다."
|
||||
|
||||
return True, response
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue