smooth-py 0.2.8.dev20251003__tar.gz → 0.2.8.dev20251006__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.2.8.dev20251003 → smooth_py-0.2.8.dev20251006}/PKG-INFO +1 -1
- {smooth_py-0.2.8.dev20251003 → smooth_py-0.2.8.dev20251006}/pyproject.toml +1 -1
- {smooth_py-0.2.8.dev20251003 → smooth_py-0.2.8.dev20251006}/src/smooth/__init__.py +32 -2
- {smooth_py-0.2.8.dev20251003 → smooth_py-0.2.8.dev20251006}/README.md +0 -0
- {smooth_py-0.2.8.dev20251003 → smooth_py-0.2.8.dev20251006}/src/smooth/mcp/__init__.py +0 -0
- {smooth_py-0.2.8.dev20251003 → smooth_py-0.2.8.dev20251006}/src/smooth/mcp/server.py +0 -0
|
@@ -38,10 +38,11 @@ def _encode_url(url: str, interactive: bool = True, embed: bool = False) -> str:
|
|
|
38
38
|
|
|
39
39
|
class TaskResponse(BaseModel):
|
|
40
40
|
"""Task response model."""
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(extra="allow")
|
|
42
43
|
|
|
43
44
|
id: str = Field(description="The ID of the task.")
|
|
44
|
-
status: Literal["waiting", "running", "done", "failed"] = Field(description="The status of the task.")
|
|
45
|
+
status: Literal["waiting", "running", "done", "failed", "cancelled"] = Field(description="The status of the task.")
|
|
45
46
|
output: Any | None = Field(default=None, description="The output of the task.")
|
|
46
47
|
credits_used: int | None = Field(default=None, description="The amount of credits used to perform the task.")
|
|
47
48
|
device: Literal["desktop", "mobile"] | None = Field(default=None, description="The device type used for the task.")
|
|
@@ -148,6 +149,7 @@ class BrowserSessionResponse(BaseModel):
|
|
|
148
149
|
"""Browser session response model."""
|
|
149
150
|
|
|
150
151
|
profile_id: str = Field(description="The ID of the browser profile associated with the opened browser instance.")
|
|
152
|
+
live_id: str | None = Field(description="The ID of the live browser session.")
|
|
151
153
|
live_url: str | None = Field(default=None, description="The live URL to interact with the browser session.")
|
|
152
154
|
|
|
153
155
|
@model_validator(mode="before")
|
|
@@ -199,6 +201,7 @@ class BrowserProfilesResponse(BaseModel):
|
|
|
199
201
|
|
|
200
202
|
class BrowserSessionsResponse(BrowserProfilesResponse):
|
|
201
203
|
"""Response model for listing browser profiles."""
|
|
204
|
+
|
|
202
205
|
pass
|
|
203
206
|
|
|
204
207
|
|
|
@@ -312,6 +315,15 @@ class TaskHandle:
|
|
|
312
315
|
"""Returns the task ID."""
|
|
313
316
|
return self._id
|
|
314
317
|
|
|
318
|
+
def stop(self):
|
|
319
|
+
"""Stops the task."""
|
|
320
|
+
try:
|
|
321
|
+
response = self._client._client.delete(f"{self._client.base_url}/task/{self._id}")
|
|
322
|
+
self._handle_response(response)
|
|
323
|
+
except requests.exceptions.RequestException as e:
|
|
324
|
+
logger.error(f"Request failed: {e}")
|
|
325
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
326
|
+
|
|
315
327
|
def result(self, timeout: int | None = None, poll_interval: float = 1) -> TaskResponse:
|
|
316
328
|
"""Waits for the task to complete and returns the result."""
|
|
317
329
|
if self._task_response and self._task_response.status not in ["running", "waiting"]:
|
|
@@ -509,6 +521,15 @@ class SmoothClient(BaseClient):
|
|
|
509
521
|
logger.error(f"Request failed: {e}")
|
|
510
522
|
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
511
523
|
|
|
524
|
+
def close_session(self, live_id: str):
|
|
525
|
+
"""Closes a browser session."""
|
|
526
|
+
try:
|
|
527
|
+
response = self._session.delete(f"{self.base_url}/browser/session/{live_id}")
|
|
528
|
+
self._handle_response(response)
|
|
529
|
+
except requests.exceptions.RequestException as e:
|
|
530
|
+
logger.error(f"Request failed: {e}")
|
|
531
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
532
|
+
|
|
512
533
|
def list_profiles(self):
|
|
513
534
|
"""Lists all browser profiles for the user.
|
|
514
535
|
|
|
@@ -797,6 +818,15 @@ class SmoothAsyncClient(BaseClient):
|
|
|
797
818
|
logger.error(f"Request failed: {e}")
|
|
798
819
|
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
799
820
|
|
|
821
|
+
async def close_session(self, live_id: str):
|
|
822
|
+
"""Closes a browser session."""
|
|
823
|
+
try:
|
|
824
|
+
response = await self._client.delete(f"{self.base_url}/browser/session/{live_id}")
|
|
825
|
+
self._handle_response(response)
|
|
826
|
+
except httpx.RequestError as e:
|
|
827
|
+
logger.error(f"Request failed: {e}")
|
|
828
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
829
|
+
|
|
800
830
|
async def list_profiles(self):
|
|
801
831
|
"""Lists all browser profiles for the user.
|
|
802
832
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|