Skip to content

Commit 6efa7c6

Browse files
feat(api): api update
1 parent 9c37892 commit 6efa7c6

15 files changed

Lines changed: 292 additions & 11 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 38
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-97dcad9b050e2818332d548e93c2882fa5482df4dca384ce7f8d3cabdfd92b69.yml
3-
openapi_spec_hash: 8d3fa51c0740046e4caf2a299ba9d89e
4-
config_hash: 03d8eae69b6431c0ae0566dddaa9b0ea
1+
configured_endpoints: 39
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-45efcdf3e5ccffb6e94a86be505b24b7b4ff05d8f1a2978c2a281729af68cb82.yml
3+
openapi_spec_hash: 9a7724672b05d44888d67b6ed0ffc7ca
4+
config_hash: dce4dea59023b0a00890fa654fbfffb4

api.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,16 @@ Methods:
9292
Types:
9393

9494
```python
95-
from steel.types.sessions import CaptchaSolveImageResponse, CaptchaStatusResponse
95+
from steel.types.sessions import (
96+
CaptchaSolveResponse,
97+
CaptchaSolveImageResponse,
98+
CaptchaStatusResponse,
99+
)
96100
```
97101

98102
Methods:
99103

104+
- <code title="post /v1/sessions/{sessionId}/captchas/solve">client.sessions.captchas.<a href="./src/steel/resources/sessions/captchas.py">solve</a>(session_id, \*\*<a href="src/steel/types/sessions/captcha_solve_params.py">params</a>) -> <a href="./src/steel/types/sessions/captcha_solve_response.py">CaptchaSolveResponse</a></code>
100105
- <code title="post /v1/sessions/{sessionId}/captchas/solve-image">client.sessions.captchas.<a href="./src/steel/resources/sessions/captchas.py">solve_image</a>(session_id, \*\*<a href="src/steel/types/sessions/captcha_solve_image_params.py">params</a>) -> <a href="./src/steel/types/sessions/captcha_solve_image_response.py">CaptchaSolveImageResponse</a></code>
101106
- <code title="get /v1/sessions/{sessionId}/captchas/status">client.sessions.captchas.<a href="./src/steel/resources/sessions/captchas.py">status</a>(session_id) -> <a href="./src/steel/types/sessions/captcha_status_response.py">CaptchaStatusResponse</a></code>
102107

src/steel/resources/sessions/captchas.py

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
async_to_streamed_response_wrapper,
1616
)
1717
from ..._base_client import make_request_options
18-
from ...types.sessions import captcha_solve_image_params
18+
from ...types.sessions import captcha_solve_params, captcha_solve_image_params
19+
from ...types.sessions.captcha_solve_response import CaptchaSolveResponse
1920
from ...types.sessions.captcha_status_response import CaptchaStatusResponse
2021
from ...types.sessions.captcha_solve_image_response import CaptchaSolveImageResponse
2122

@@ -42,6 +43,59 @@ def with_streaming_response(self) -> CaptchasResourceWithStreamingResponse:
4243
"""
4344
return CaptchasResourceWithStreamingResponse(self)
4445

46+
def solve(
47+
self,
48+
session_id: str,
49+
*,
50+
page_id: str | Omit = omit,
51+
task_id: str | Omit = omit,
52+
url: str | Omit = omit,
53+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54+
# The extra values given here take precedence over values defined on the client or passed to this method.
55+
extra_headers: Headers | None = None,
56+
extra_query: Query | None = None,
57+
extra_body: Body | None = None,
58+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
59+
) -> CaptchaSolveResponse:
60+
"""Solves captcha(s) for the session.
61+
62+
If pageId, url, or taskId is provided, solves
63+
that specific captcha. If no parameters are provided, solves all detected
64+
captchas. Use this when autoCaptchaSolving is disabled in stealthConfig.
65+
66+
Args:
67+
page_id: The page ID where the captcha is located
68+
69+
task_id: The task ID of the specific captcha to solve
70+
71+
url: The URL where the captcha is located
72+
73+
extra_headers: Send extra headers
74+
75+
extra_query: Add additional query parameters to the request
76+
77+
extra_body: Add additional JSON properties to the request
78+
79+
timeout: Override the client-level default timeout for this request, in seconds
80+
"""
81+
if not session_id:
82+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
83+
return self._post(
84+
f"/v1/sessions/{session_id}/captchas/solve",
85+
body=maybe_transform(
86+
{
87+
"page_id": page_id,
88+
"task_id": task_id,
89+
"url": url,
90+
},
91+
captcha_solve_params.CaptchaSolveParams,
92+
),
93+
options=make_request_options(
94+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
95+
),
96+
cast_to=CaptchaSolveResponse,
97+
)
98+
4599
def solve_image(
46100
self,
47101
session_id: str,
@@ -146,6 +200,59 @@ def with_streaming_response(self) -> AsyncCaptchasResourceWithStreamingResponse:
146200
"""
147201
return AsyncCaptchasResourceWithStreamingResponse(self)
148202

203+
async def solve(
204+
self,
205+
session_id: str,
206+
*,
207+
page_id: str | Omit = omit,
208+
task_id: str | Omit = omit,
209+
url: str | Omit = omit,
210+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211+
# The extra values given here take precedence over values defined on the client or passed to this method.
212+
extra_headers: Headers | None = None,
213+
extra_query: Query | None = None,
214+
extra_body: Body | None = None,
215+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
216+
) -> CaptchaSolveResponse:
217+
"""Solves captcha(s) for the session.
218+
219+
If pageId, url, or taskId is provided, solves
220+
that specific captcha. If no parameters are provided, solves all detected
221+
captchas. Use this when autoCaptchaSolving is disabled in stealthConfig.
222+
223+
Args:
224+
page_id: The page ID where the captcha is located
225+
226+
task_id: The task ID of the specific captcha to solve
227+
228+
url: The URL where the captcha is located
229+
230+
extra_headers: Send extra headers
231+
232+
extra_query: Add additional query parameters to the request
233+
234+
extra_body: Add additional JSON properties to the request
235+
236+
timeout: Override the client-level default timeout for this request, in seconds
237+
"""
238+
if not session_id:
239+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
240+
return await self._post(
241+
f"/v1/sessions/{session_id}/captchas/solve",
242+
body=await async_maybe_transform(
243+
{
244+
"page_id": page_id,
245+
"task_id": task_id,
246+
"url": url,
247+
},
248+
captcha_solve_params.CaptchaSolveParams,
249+
),
250+
options=make_request_options(
251+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
252+
),
253+
cast_to=CaptchaSolveResponse,
254+
)
255+
149256
async def solve_image(
150257
self,
151258
session_id: str,
@@ -234,6 +341,9 @@ class CaptchasResourceWithRawResponse:
234341
def __init__(self, captchas: CaptchasResource) -> None:
235342
self._captchas = captchas
236343

344+
self.solve = to_raw_response_wrapper(
345+
captchas.solve,
346+
)
237347
self.solve_image = to_raw_response_wrapper(
238348
captchas.solve_image,
239349
)
@@ -246,6 +356,9 @@ class AsyncCaptchasResourceWithRawResponse:
246356
def __init__(self, captchas: AsyncCaptchasResource) -> None:
247357
self._captchas = captchas
248358

359+
self.solve = async_to_raw_response_wrapper(
360+
captchas.solve,
361+
)
249362
self.solve_image = async_to_raw_response_wrapper(
250363
captchas.solve_image,
251364
)
@@ -258,6 +371,9 @@ class CaptchasResourceWithStreamingResponse:
258371
def __init__(self, captchas: CaptchasResource) -> None:
259372
self._captchas = captchas
260373

374+
self.solve = to_streamed_response_wrapper(
375+
captchas.solve,
376+
)
261377
self.solve_image = to_streamed_response_wrapper(
262378
captchas.solve_image,
263379
)
@@ -270,6 +386,9 @@ class AsyncCaptchasResourceWithStreamingResponse:
270386
def __init__(self, captchas: AsyncCaptchasResource) -> None:
271387
self._captchas = captchas
272388

389+
self.solve = async_to_streamed_response_wrapper(
390+
captchas.solve,
391+
)
273392
self.solve_image = async_to_streamed_response_wrapper(
274393
captchas.solve_image,
275394
)

src/steel/types/profile_create_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ class ProfileCreateResponse(BaseModel):
497497
source_session_id: Optional[str] = FieldInfo(alias="sourceSessionId", default=None)
498498
"""The last session ID associated with the profile"""
499499

500-
status: Literal["UPLOADING", "READY", "FAILED", "DELETED"]
500+
status: Literal["UPLOADING", "READY", "FAILED"]
501501
"""The status of the profile"""
502502

503503
updated_at: datetime = FieldInfo(alias="updatedAt")

src/steel/types/profile_get_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ class ProfileGetResponse(BaseModel):
497497
source_session_id: Optional[str] = FieldInfo(alias="sourceSessionId", default=None)
498498
"""The last session ID associated with the profile"""
499499

500-
status: Literal["UPLOADING", "READY", "FAILED", "DELETED"]
500+
status: Literal["UPLOADING", "READY", "FAILED"]
501501
"""The status of the profile"""
502502

503503
updated_at: datetime = FieldInfo(alias="updatedAt")

src/steel/types/profile_list_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class Profile(BaseModel):
498498
source_session_id: Optional[str] = FieldInfo(alias="sourceSessionId", default=None)
499499
"""The last session ID associated with the profile"""
500500

501-
status: Literal["UPLOADING", "READY", "FAILED", "DELETED"]
501+
status: Literal["UPLOADING", "READY", "FAILED"]
502502
"""The status of the profile"""
503503

504504
updated_at: datetime = FieldInfo(alias="updatedAt")

src/steel/types/profile_update_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ class ProfileUpdateResponse(BaseModel):
497497
source_session_id: Optional[str] = FieldInfo(alias="sourceSessionId", default=None)
498498
"""The last session ID associated with the profile"""
499499

500-
status: Literal["UPLOADING", "READY", "FAILED", "DELETED"]
500+
status: Literal["UPLOADING", "READY", "FAILED"]
501501
"""The status of the profile"""
502502

503503
updated_at: datetime = FieldInfo(alias="updatedAt")

src/steel/types/session.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class DeviceConfig(BaseModel):
6363
class StealthConfig(BaseModel):
6464
"""Stealth configuration for the session"""
6565

66+
auto_captcha_solving: Optional[bool] = FieldInfo(alias="autoCaptchaSolving", default=None)
67+
"""When true, captchas will be automatically solved when detected.
68+
69+
When false, use the solve endpoints to manually initiate solving.
70+
"""
71+
6672
humanize_interactions: Optional[bool] = FieldInfo(alias="humanizeInteractions", default=None)
6773
"""
6874
This flag will make the browser act more human-like by moving the mouse in a

src/steel/types/session_create_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ class SessionContext(TypedDict, total=False):
317317
class StealthConfig(TypedDict, total=False):
318318
"""Stealth configuration for the session"""
319319

320+
auto_captcha_solving: Annotated[bool, PropertyInfo(alias="autoCaptchaSolving")]
321+
"""When true, captchas will be automatically solved when detected.
322+
323+
When false, use the solve endpoints to manually initiate solving.
324+
"""
325+
320326
humanize_interactions: Annotated[bool, PropertyInfo(alias="humanizeInteractions")]
321327
"""
322328
This flag will make the browser act more human-like by moving the mouse in a

src/steel/types/sessions/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from __future__ import annotations
44

55
from .file_upload_params import FileUploadParams as FileUploadParams
6+
from .captcha_solve_params import CaptchaSolveParams as CaptchaSolveParams
7+
from .captcha_solve_response import CaptchaSolveResponse as CaptchaSolveResponse
68
from .captcha_status_response import CaptchaStatusResponse as CaptchaStatusResponse
79
from .captcha_solve_image_params import CaptchaSolveImageParams as CaptchaSolveImageParams
810
from .captcha_solve_image_response import CaptchaSolveImageResponse as CaptchaSolveImageResponse

0 commit comments

Comments
 (0)