3232from ...types .session_context import SessionContext
3333from ...types .session_events_response import SessionEventsResponse
3434from ...types .session_release_response import SessionReleaseResponse
35+ from ...types .session_release_all_response import SessionReleaseAllResponse
3536from ...types .session_live_details_response import SessionLiveDetailsResponse
3637
3738__all__ = ["SessionsResource" , "AsyncSessionsResource" ]
@@ -71,6 +72,7 @@ def create(
7172 is_selenium : bool | NotGiven = NOT_GIVEN ,
7273 namespace : str | NotGiven = NOT_GIVEN ,
7374 proxy_url : str | NotGiven = NOT_GIVEN ,
75+ region : Literal ["lax" , "ord" , "iad" , "bom" , "scl" , "fra" , "hkg" ] | NotGiven = NOT_GIVEN ,
7476 session_context : session_create_params .SessionContext | NotGiven = NOT_GIVEN ,
7577 session_id : str | NotGiven = NOT_GIVEN ,
7678 solve_captcha : bool | NotGiven = NOT_GIVEN ,
@@ -105,6 +107,8 @@ def create(
105107 Steel-provided proxies in favor of your specified proxy. Format:
106108 http(s)://username:password@hostname:port
107109
110+ region: The desired region for the session to be started in
111+
108112 session_context: Session context data to be used in the created session. Sessions will start with
109113 an empty context by default.
110114
@@ -138,6 +142,7 @@ def create(
138142 "is_selenium" : is_selenium ,
139143 "namespace" : namespace ,
140144 "proxy_url" : proxy_url ,
145+ "region" : region ,
141146 "session_context" : session_context ,
142147 "session_id" : session_id ,
143148 "solve_captcha" : solve_captcha ,
@@ -369,6 +374,25 @@ def release(
369374 cast_to = SessionReleaseResponse ,
370375 )
371376
377+ def release_all (
378+ self ,
379+ * ,
380+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
381+ # The extra values given here take precedence over values defined on the client or passed to this method.
382+ extra_headers : Headers | None = None ,
383+ extra_query : Query | None = None ,
384+ extra_body : Body | None = None ,
385+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
386+ ) -> SessionReleaseAllResponse :
387+ """Releases all active sessions for the current organization."""
388+ return self ._post (
389+ "/v1/sessions/release" ,
390+ options = make_request_options (
391+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
392+ ),
393+ cast_to = SessionReleaseAllResponse ,
394+ )
395+
372396
373397class AsyncSessionsResource (AsyncAPIResource ):
374398 @cached_property
@@ -404,6 +428,7 @@ async def create(
404428 is_selenium : bool | NotGiven = NOT_GIVEN ,
405429 namespace : str | NotGiven = NOT_GIVEN ,
406430 proxy_url : str | NotGiven = NOT_GIVEN ,
431+ region : Literal ["lax" , "ord" , "iad" , "bom" , "scl" , "fra" , "hkg" ] | NotGiven = NOT_GIVEN ,
407432 session_context : session_create_params .SessionContext | NotGiven = NOT_GIVEN ,
408433 session_id : str | NotGiven = NOT_GIVEN ,
409434 solve_captcha : bool | NotGiven = NOT_GIVEN ,
@@ -438,6 +463,8 @@ async def create(
438463 Steel-provided proxies in favor of your specified proxy. Format:
439464 http(s)://username:password@hostname:port
440465
466+ region: The desired region for the session to be started in
467+
441468 session_context: Session context data to be used in the created session. Sessions will start with
442469 an empty context by default.
443470
@@ -471,6 +498,7 @@ async def create(
471498 "is_selenium" : is_selenium ,
472499 "namespace" : namespace ,
473500 "proxy_url" : proxy_url ,
501+ "region" : region ,
474502 "session_context" : session_context ,
475503 "session_id" : session_id ,
476504 "solve_captcha" : solve_captcha ,
@@ -702,6 +730,25 @@ async def release(
702730 cast_to = SessionReleaseResponse ,
703731 )
704732
733+ async def release_all (
734+ self ,
735+ * ,
736+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
737+ # The extra values given here take precedence over values defined on the client or passed to this method.
738+ extra_headers : Headers | None = None ,
739+ extra_query : Query | None = None ,
740+ extra_body : Body | None = None ,
741+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
742+ ) -> SessionReleaseAllResponse :
743+ """Releases all active sessions for the current organization."""
744+ return await self ._post (
745+ "/v1/sessions/release" ,
746+ options = make_request_options (
747+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
748+ ),
749+ cast_to = SessionReleaseAllResponse ,
750+ )
751+
705752
706753class SessionsResourceWithRawResponse :
707754 def __init__ (self , sessions : SessionsResource ) -> None :
@@ -728,6 +775,9 @@ def __init__(self, sessions: SessionsResource) -> None:
728775 self .release = to_raw_response_wrapper (
729776 sessions .release ,
730777 )
778+ self .release_all = to_raw_response_wrapper (
779+ sessions .release_all ,
780+ )
731781
732782 @cached_property
733783 def files (self ) -> FilesResourceWithRawResponse :
@@ -759,6 +809,9 @@ def __init__(self, sessions: AsyncSessionsResource) -> None:
759809 self .release = async_to_raw_response_wrapper (
760810 sessions .release ,
761811 )
812+ self .release_all = async_to_raw_response_wrapper (
813+ sessions .release_all ,
814+ )
762815
763816 @cached_property
764817 def files (self ) -> AsyncFilesResourceWithRawResponse :
@@ -790,6 +843,9 @@ def __init__(self, sessions: SessionsResource) -> None:
790843 self .release = to_streamed_response_wrapper (
791844 sessions .release ,
792845 )
846+ self .release_all = to_streamed_response_wrapper (
847+ sessions .release_all ,
848+ )
793849
794850 @cached_property
795851 def files (self ) -> FilesResourceWithStreamingResponse :
@@ -821,6 +877,9 @@ def __init__(self, sessions: AsyncSessionsResource) -> None:
821877 self .release = async_to_streamed_response_wrapper (
822878 sessions .release ,
823879 )
880+ self .release_all = async_to_streamed_response_wrapper (
881+ sessions .release_all ,
882+ )
824883
825884 @cached_property
826885 def files (self ) -> AsyncFilesResourceWithStreamingResponse :
0 commit comments