|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from typing import Optional |
| 4 | +from typing_extensions import Literal |
| 5 | + |
| 6 | +from ..._models import BaseModel |
| 7 | +from .browser_event_source import BrowserEventSource |
| 8 | + |
| 9 | +__all__ = ["BrowserCaptchaChallengeResultEvent", "Data"] |
| 10 | + |
| 11 | + |
| 12 | +class Data(BaseModel): |
| 13 | + """Per-challenge payload. |
| 14 | +
|
| 15 | + This event is emitted once per challenge and determines its overall outcome; captcha_solve_started and captcha_solve_result describe individual tasks and may occur multiple times within the challenge. |
| 16 | + """ |
| 17 | + |
| 18 | + captcha_type: Literal["hcaptcha", "recaptcha_v2", "recaptcha_v3", "turnstile", "geetest", "press_and_hold", "other"] |
| 19 | + """Captcha kind. |
| 20 | +
|
| 21 | + Enterprise reCAPTCHA variants are grouped into their version bucket |
| 22 | + (recaptcha_v2 or recaptcha_v3), press-and-hold challenges use press_and_hold, |
| 23 | + and unlisted kinds use other. |
| 24 | + """ |
| 25 | + |
| 26 | + challenge_id: str |
| 27 | + """Opaque identifier shared by events for one visible challenge. |
| 28 | +
|
| 29 | + An image-grid captcha may create multiple task_id values for one challenge_id. |
| 30 | + The same value may continue across a page reload when the challenge episode |
| 31 | + continues. It does not indicate task ordering or challenge completion. |
| 32 | + """ |
| 33 | + |
| 34 | + duration_ms: float |
| 35 | + """ |
| 36 | + Wall-clock duration from the challenge appearing to its terminal outcome, |
| 37 | + covering every solver attempt in between. |
| 38 | + """ |
| 39 | + |
| 40 | + status: Literal["solved", "failure", "timeout", "abandoned"] |
| 41 | + """Terminal outcome of the visible challenge. |
| 42 | +
|
| 43 | + solved: the page observed the challenge clear after a solver attempt. failure: a |
| 44 | + terminal solver failure occurred, or all attempts ended while the challenge |
| 45 | + remained. timeout: the challenge-level wait budget expired while the challenge |
| 46 | + remained. abandoned: observation ended without an attributable terminal |
| 47 | + challenge outcome. This includes a dismissed widget or page unload without a |
| 48 | + solved signal or terminal solver outcome, and a token appearing while multiple |
| 49 | + same-provider challenges are open, because the producer cannot attribute that |
| 50 | + token to this visible challenge. A captcha_solve_result with the same |
| 51 | + challenge_id may therefore report success while the challenge result reports |
| 52 | + abandoned. A solved challenge does not prove the site accepted the token or that |
| 53 | + the guarded action succeeded. |
| 54 | + """ |
| 55 | + |
| 56 | + website_host: Optional[str] = None |
| 57 | + """Host of the page where the challenge appeared.""" |
| 58 | + |
| 59 | + website_path: Optional[str] = None |
| 60 | + """Path of the page where the challenge appeared. Query string excluded.""" |
| 61 | + |
| 62 | + |
| 63 | +class BrowserCaptchaChallengeResultEvent(BaseModel): |
| 64 | + """A visible captcha challenge reached a terminal outcome.""" |
| 65 | + |
| 66 | + category: Literal["captcha"] |
| 67 | + |
| 68 | + data: Data |
| 69 | + """Per-challenge payload. |
| 70 | +
|
| 71 | + This event is emitted once per challenge and determines its overall outcome; |
| 72 | + captcha_solve_started and captcha_solve_result describe individual tasks and may |
| 73 | + occur multiple times within the challenge. |
| 74 | + """ |
| 75 | + |
| 76 | + source: BrowserEventSource |
| 77 | + """Provenance metadata identifying which producer emitted the event.""" |
| 78 | + |
| 79 | + ts: int |
| 80 | + """Event timestamp in Unix microseconds.""" |
| 81 | + |
| 82 | + type: Literal["captcha_challenge_result"] |
| 83 | + |
| 84 | + truncated: Optional[bool] = None |
| 85 | + """True if the data field was truncated due to size limits.""" |
0 commit comments