@@ -151,14 +151,15 @@ async def init(self):
151
151
timeout = self .timeout_settings
152
152
)
153
153
154
- # Check server health
155
- await self ._check_server_health ()
156
-
157
154
# Create session if we don't have one
158
155
if not self .session_id :
159
156
await self ._create_session ()
160
157
self ._log (f"Created new session: { self .session_id } " , level = 3 )
161
158
159
+ ###
160
+ # TODO: throw log for unauthorized (401) key not whitelisted
161
+ ###
162
+
162
163
# Start Playwright and connect to remote
163
164
self ._log ("Starting Playwright..." , level = 3 )
164
165
self ._playwright = await async_playwright ().start ()
@@ -237,42 +238,6 @@ async def close(self):
237
238
238
239
self ._closed = True
239
240
240
- async def _check_server_health (self , timeout : int = 10 ):
241
- """
242
- Ping /healthcheck to verify the server is available.
243
- Uses exponential backoff for retries.
244
- """
245
- start = time .time ()
246
- attempt = 0
247
- while True :
248
- try :
249
- client = self .httpx_client or httpx .AsyncClient (
250
- timeout = self .timeout_settings
251
- )
252
- async with client :
253
- headers = {
254
- "x-bb-api-key" : self .browserbase_api_key ,
255
- }
256
- resp = await client .get (
257
- f"{ self .server_url } /healthcheck" , headers = headers
258
- )
259
- if resp .status_code == 200 :
260
- data = resp .json ()
261
- if data .get ("status" ) == "ok" :
262
- self ._log ("Healthcheck passed. Server is running." , level = 3 )
263
- return
264
- except Exception as e :
265
- self ._log (f"Healthcheck error: { str (e )} " , level = 3 )
266
-
267
- if time .time () - start > timeout :
268
- raise TimeoutError (f"Server not responding after { timeout } seconds." )
269
-
270
- wait_time = min (
271
- 2 ** attempt * 0.5 , 5.0
272
- ) # Exponential backoff, capped at 5 seconds
273
- await asyncio .sleep (wait_time )
274
- attempt += 1
275
-
276
241
async def _create_session (self ):
277
242
"""
278
243
Create a new session by calling /sessions/start on the server.
0 commit comments