smooth-py 0.3.0.dev20251014__tar.gz → 0.3.0.post2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smooth-py might be problematic. Click here for more details.
- {smooth_py-0.3.0.dev20251014 → smooth_py-0.3.0.post2}/PKG-INFO +1 -1
- {smooth_py-0.3.0.dev20251014 → smooth_py-0.3.0.post2}/pyproject.toml +1 -1
- {smooth_py-0.3.0.dev20251014 → smooth_py-0.3.0.post2}/src/smooth/__init__.py +31 -7
- {smooth_py-0.3.0.dev20251014 → smooth_py-0.3.0.post2}/README.md +0 -0
- {smooth_py-0.3.0.dev20251014 → smooth_py-0.3.0.post2}/src/smooth/mcp/__init__.py +0 -0
- {smooth_py-0.3.0.dev20251014 → smooth_py-0.3.0.post2}/src/smooth/mcp/server.py +0 -0
|
@@ -82,7 +82,11 @@ class TaskRequest(BaseModel):
|
|
|
82
82
|
description=("Browser profile ID to use. Each profile maintains its own state, such as cookies and login credentials."),
|
|
83
83
|
)
|
|
84
84
|
profile_read_only: bool = Field(
|
|
85
|
-
default=False,
|
|
85
|
+
default=False,
|
|
86
|
+
description=(
|
|
87
|
+
"If true, the profile specified by `profile_id` will be loaded in read-only mode. "
|
|
88
|
+
"Changes made during the task will not be saved back to the profile."
|
|
89
|
+
),
|
|
86
90
|
)
|
|
87
91
|
stealth_mode: bool = Field(default=False, description="Run the browser in stealth mode.")
|
|
88
92
|
proxy_server: str | None = Field(
|
|
@@ -330,6 +334,10 @@ class BrowserSessionHandle(BaseModel):
|
|
|
330
334
|
return _encode_url(self.browser_session.live_url, interactive=interactive, embed=embed)
|
|
331
335
|
return None
|
|
332
336
|
|
|
337
|
+
def live_id(self):
|
|
338
|
+
"""Returns the live ID for the browser session."""
|
|
339
|
+
return self.browser_session.live_id
|
|
340
|
+
|
|
333
341
|
|
|
334
342
|
class TaskHandle:
|
|
335
343
|
"""A handle to a running task."""
|
|
@@ -393,6 +401,14 @@ class TaskHandle:
|
|
|
393
401
|
task_response = self._client._get_task(self.id())
|
|
394
402
|
self._task_response = task_response
|
|
395
403
|
if task_response.recording_url is not None:
|
|
404
|
+
if not task_response.recording_url:
|
|
405
|
+
raise ApiError(
|
|
406
|
+
status_code=404,
|
|
407
|
+
detail=(
|
|
408
|
+
f"Recording URL not available for task {self.id()}."
|
|
409
|
+
" Set `enable_recording=True` when creating the task to enable it."
|
|
410
|
+
)
|
|
411
|
+
)
|
|
396
412
|
return task_response.recording_url
|
|
397
413
|
time.sleep(1)
|
|
398
414
|
raise TimeoutError(f"Recording URL not available for task {self.id()}.")
|
|
@@ -466,7 +482,7 @@ class SmoothClient(BaseClient):
|
|
|
466
482
|
max_steps: int = 32,
|
|
467
483
|
device: Literal["desktop", "mobile"] = "mobile",
|
|
468
484
|
allowed_urls: list[str] | None = None,
|
|
469
|
-
enable_recording: bool =
|
|
485
|
+
enable_recording: bool = True,
|
|
470
486
|
session_id: str | None = None,
|
|
471
487
|
profile_id: str | None = None,
|
|
472
488
|
profile_read_only: bool = False,
|
|
@@ -577,7 +593,7 @@ class SmoothClient(BaseClient):
|
|
|
577
593
|
ApiException: If the API request fails.
|
|
578
594
|
"""
|
|
579
595
|
try:
|
|
580
|
-
response = self._session.get(f"{self.base_url}/browser/
|
|
596
|
+
response = self._session.get(f"{self.base_url}/browser/profile")
|
|
581
597
|
data = self._handle_response(response)
|
|
582
598
|
return BrowserProfilesResponse(**data["r"])
|
|
583
599
|
except requests.exceptions.RequestException as e:
|
|
@@ -592,7 +608,7 @@ class SmoothClient(BaseClient):
|
|
|
592
608
|
def delete_profile(self, profile_id: str):
|
|
593
609
|
"""Delete a browser profile."""
|
|
594
610
|
try:
|
|
595
|
-
response = self._session.delete(f"{self.base_url}/browser/
|
|
611
|
+
response = self._session.delete(f"{self.base_url}/browser/profile/{profile_id}")
|
|
596
612
|
self._handle_response(response)
|
|
597
613
|
except requests.exceptions.RequestException as e:
|
|
598
614
|
logger.error(f"Request failed: {e}")
|
|
@@ -711,6 +727,14 @@ class AsyncTaskHandle:
|
|
|
711
727
|
task_response = await self._client._get_task(self.id())
|
|
712
728
|
self._task_response = task_response
|
|
713
729
|
if task_response.recording_url is not None:
|
|
730
|
+
if not task_response.recording_url:
|
|
731
|
+
raise ApiError(
|
|
732
|
+
status_code=404,
|
|
733
|
+
detail=(
|
|
734
|
+
f"Recording URL not available for task {self.id()}."
|
|
735
|
+
" Set `enable_recording=True` when creating the task to enable it."
|
|
736
|
+
)
|
|
737
|
+
)
|
|
714
738
|
return task_response.recording_url
|
|
715
739
|
await asyncio.sleep(1)
|
|
716
740
|
|
|
@@ -779,7 +803,7 @@ class SmoothAsyncClient(BaseClient):
|
|
|
779
803
|
max_steps: int = 32,
|
|
780
804
|
device: Literal["desktop", "mobile"] = "mobile",
|
|
781
805
|
allowed_urls: list[str] | None = None,
|
|
782
|
-
enable_recording: bool =
|
|
806
|
+
enable_recording: bool = True,
|
|
783
807
|
session_id: str | None = None,
|
|
784
808
|
profile_id: str | None = None,
|
|
785
809
|
profile_read_only: bool = False,
|
|
@@ -890,7 +914,7 @@ class SmoothAsyncClient(BaseClient):
|
|
|
890
914
|
ApiException: If the API request fails.
|
|
891
915
|
"""
|
|
892
916
|
try:
|
|
893
|
-
response = await self._client.get(f"{self.base_url}/browser/
|
|
917
|
+
response = await self._client.get(f"{self.base_url}/browser/profile")
|
|
894
918
|
data = self._handle_response(response)
|
|
895
919
|
return BrowserProfilesResponse(**data["r"])
|
|
896
920
|
except httpx.RequestError as e:
|
|
@@ -905,7 +929,7 @@ class SmoothAsyncClient(BaseClient):
|
|
|
905
929
|
async def delete_profile(self, profile_id: str):
|
|
906
930
|
"""Delete a browser profile."""
|
|
907
931
|
try:
|
|
908
|
-
response = await self._client.delete(f"{self.base_url}/browser/
|
|
932
|
+
response = await self._client.delete(f"{self.base_url}/browser/profile/{profile_id}")
|
|
909
933
|
self._handle_response(response)
|
|
910
934
|
except httpx.RequestError as e:
|
|
911
935
|
logger.error(f"Request failed: {e}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|