6262 AsyncComputerResourceWithStreamingResponse ,
6363)
6464from ..._compat import cached_property
65+ from .telemetry import (
66+ TelemetryResource ,
67+ AsyncTelemetryResource ,
68+ TelemetryResourceWithRawResponse ,
69+ AsyncTelemetryResourceWithRawResponse ,
70+ TelemetryResourceWithStreamingResponse ,
71+ AsyncTelemetryResourceWithStreamingResponse ,
72+ )
6573from .playwright import (
6674 PlaywrightResource ,
6775 AsyncPlaywrightResource ,
94102from ...types .shared_params .browser_profile import BrowserProfile
95103from ...types .shared_params .browser_viewport import BrowserViewport
96104from ...types .shared_params .browser_extension import BrowserExtension
105+ from ...types .browsers .browser_telemetry_config_param import BrowserTelemetryConfigParam
97106
98107__all__ = ["BrowsersResource" , "AsyncBrowsersResource" ]
99108
100109
101110class BrowsersResource (SyncAPIResource ):
102111 """Create and manage browser sessions."""
103112
113+ @cached_property
114+ def telemetry (self ) -> TelemetryResource :
115+ """Stream live telemetry events from a browser session."""
116+ return TelemetryResource (self ._client )
117+
104118 @cached_property
105119 def replays (self ) -> ReplaysResource :
106120 """Record and manage browser session video replays."""
@@ -163,6 +177,7 @@ def create(
163177 proxy_id : str | Omit = omit ,
164178 start_url : str | Omit = omit ,
165179 stealth : bool | Omit = omit ,
180+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
166181 timeout_seconds : int | Omit = omit ,
167182 viewport : BrowserViewport | Omit = omit ,
168183 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -211,6 +226,10 @@ def create(
211226 stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
212227 mechanisms.
213228
229+ telemetry: Telemetry configuration for the browser session. If provided, telemetry capture
230+ starts with the specified category filter when the session is created. If
231+ omitted, no telemetry capture is started.
232+
214233 timeout_seconds: The number of seconds of inactivity before the browser session is terminated.
215234 Activity includes CDP connections and live view connections. Defaults to 60
216235 seconds. Minimum allowed is 10 seconds. Maximum allowed is 259200 (72 hours). We
@@ -253,6 +272,7 @@ def create(
253272 "proxy_id" : proxy_id ,
254273 "start_url" : start_url ,
255274 "stealth" : stealth ,
275+ "telemetry" : telemetry ,
256276 "timeout_seconds" : timeout_seconds ,
257277 "viewport" : viewport ,
258278 },
@@ -313,6 +333,7 @@ def update(
313333 disable_default_proxy : bool | Omit = omit ,
314334 profile : BrowserProfile | Omit = omit ,
315335 proxy_id : Optional [str ] | Omit = omit ,
336+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
316337 viewport : browser_update_params .Viewport | Omit = omit ,
317338 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
318339 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -334,6 +355,11 @@ def update(
334355 proxy_id: ID of the proxy to use. Omit to leave unchanged, set to empty string to remove
335356 proxy.
336357
358+ telemetry: Telemetry configuration. Omit, set to null, or set to an empty object ({}) to
359+ leave the existing configuration unchanged (no-op). To enable capture for all
360+ categories using VM defaults, set browser to an empty object ({"browser": {}}).
361+ To stop capture, set every category's enabled to false.
362+
337363 viewport: Viewport configuration to apply to the browser session.
338364
339365 extra_headers: Send extra headers
@@ -353,6 +379,7 @@ def update(
353379 "disable_default_proxy" : disable_default_proxy ,
354380 "profile" : profile ,
355381 "proxy_id" : proxy_id ,
382+ "telemetry" : telemetry ,
356383 "viewport" : viewport ,
357384 },
358385 browser_update_params .BrowserUpdateParams ,
@@ -673,6 +700,11 @@ def load_extensions(
673700class AsyncBrowsersResource (AsyncAPIResource ):
674701 """Create and manage browser sessions."""
675702
703+ @cached_property
704+ def telemetry (self ) -> AsyncTelemetryResource :
705+ """Stream live telemetry events from a browser session."""
706+ return AsyncTelemetryResource (self ._client )
707+
676708 @cached_property
677709 def replays (self ) -> AsyncReplaysResource :
678710 """Record and manage browser session video replays."""
@@ -735,6 +767,7 @@ async def create(
735767 proxy_id : str | Omit = omit ,
736768 start_url : str | Omit = omit ,
737769 stealth : bool | Omit = omit ,
770+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
738771 timeout_seconds : int | Omit = omit ,
739772 viewport : BrowserViewport | Omit = omit ,
740773 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -783,6 +816,10 @@ async def create(
783816 stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
784817 mechanisms.
785818
819+ telemetry: Telemetry configuration for the browser session. If provided, telemetry capture
820+ starts with the specified category filter when the session is created. If
821+ omitted, no telemetry capture is started.
822+
786823 timeout_seconds: The number of seconds of inactivity before the browser session is terminated.
787824 Activity includes CDP connections and live view connections. Defaults to 60
788825 seconds. Minimum allowed is 10 seconds. Maximum allowed is 259200 (72 hours). We
@@ -825,6 +862,7 @@ async def create(
825862 "proxy_id" : proxy_id ,
826863 "start_url" : start_url ,
827864 "stealth" : stealth ,
865+ "telemetry" : telemetry ,
828866 "timeout_seconds" : timeout_seconds ,
829867 "viewport" : viewport ,
830868 },
@@ -885,6 +923,7 @@ async def update(
885923 disable_default_proxy : bool | Omit = omit ,
886924 profile : BrowserProfile | Omit = omit ,
887925 proxy_id : Optional [str ] | Omit = omit ,
926+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
888927 viewport : browser_update_params .Viewport | Omit = omit ,
889928 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
890929 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -906,6 +945,11 @@ async def update(
906945 proxy_id: ID of the proxy to use. Omit to leave unchanged, set to empty string to remove
907946 proxy.
908947
948+ telemetry: Telemetry configuration. Omit, set to null, or set to an empty object ({}) to
949+ leave the existing configuration unchanged (no-op). To enable capture for all
950+ categories using VM defaults, set browser to an empty object ({"browser": {}}).
951+ To stop capture, set every category's enabled to false.
952+
909953 viewport: Viewport configuration to apply to the browser session.
910954
911955 extra_headers: Send extra headers
@@ -925,6 +969,7 @@ async def update(
925969 "disable_default_proxy" : disable_default_proxy ,
926970 "profile" : profile ,
927971 "proxy_id" : proxy_id ,
972+ "telemetry" : telemetry ,
928973 "viewport" : viewport ,
929974 },
930975 browser_update_params .BrowserUpdateParams ,
@@ -1275,6 +1320,11 @@ def __init__(self, browsers: BrowsersResource) -> None:
12751320 browsers .load_extensions ,
12761321 )
12771322
1323+ @cached_property
1324+ def telemetry (self ) -> TelemetryResourceWithRawResponse :
1325+ """Stream live telemetry events from a browser session."""
1326+ return TelemetryResourceWithRawResponse (self ._browsers .telemetry )
1327+
12781328 @cached_property
12791329 def replays (self ) -> ReplaysResourceWithRawResponse :
12801330 """Record and manage browser session video replays."""
@@ -1336,6 +1386,11 @@ def __init__(self, browsers: AsyncBrowsersResource) -> None:
13361386 browsers .load_extensions ,
13371387 )
13381388
1389+ @cached_property
1390+ def telemetry (self ) -> AsyncTelemetryResourceWithRawResponse :
1391+ """Stream live telemetry events from a browser session."""
1392+ return AsyncTelemetryResourceWithRawResponse (self ._browsers .telemetry )
1393+
13391394 @cached_property
13401395 def replays (self ) -> AsyncReplaysResourceWithRawResponse :
13411396 """Record and manage browser session video replays."""
@@ -1397,6 +1452,11 @@ def __init__(self, browsers: BrowsersResource) -> None:
13971452 browsers .load_extensions ,
13981453 )
13991454
1455+ @cached_property
1456+ def telemetry (self ) -> TelemetryResourceWithStreamingResponse :
1457+ """Stream live telemetry events from a browser session."""
1458+ return TelemetryResourceWithStreamingResponse (self ._browsers .telemetry )
1459+
14001460 @cached_property
14011461 def replays (self ) -> ReplaysResourceWithStreamingResponse :
14021462 """Record and manage browser session video replays."""
@@ -1458,6 +1518,11 @@ def __init__(self, browsers: AsyncBrowsersResource) -> None:
14581518 browsers .load_extensions ,
14591519 )
14601520
1521+ @cached_property
1522+ def telemetry (self ) -> AsyncTelemetryResourceWithStreamingResponse :
1523+ """Stream live telemetry events from a browser session."""
1524+ return AsyncTelemetryResourceWithStreamingResponse (self ._browsers .telemetry )
1525+
14611526 @cached_property
14621527 def replays (self ) -> AsyncReplaysResourceWithStreamingResponse :
14631528 """Record and manage browser session video replays."""
0 commit comments