smooth-py 0.2.3.dev20250918__tar.gz → 0.2.4.dev20250922__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.3.dev20250918 → smooth_py-0.2.4.dev20250922}/PKG-INFO +1 -1
- {smooth_py-0.2.3.dev20250918 → smooth_py-0.2.4.dev20250922}/pyproject.toml +1 -1
- {smooth_py-0.2.3.dev20250918 → smooth_py-0.2.4.dev20250922}/src/smooth/__init__.py +40 -30
- {smooth_py-0.2.3.dev20250918 → smooth_py-0.2.4.dev20250922}/README.md +0 -0
- {smooth_py-0.2.3.dev20250918 → smooth_py-0.2.4.dev20250922}/src/smooth/mcp/__init__.py +0 -0
- {smooth_py-0.2.3.dev20250918 → smooth_py-0.2.4.dev20250922}/src/smooth/mcp/server.py +0 -0
|
@@ -105,7 +105,7 @@ class BrowserSessionsResponse(BaseModel):
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
class UploadFileResponse(BaseModel):
|
|
108
|
-
"""Response model for
|
|
108
|
+
"""Response model for uploading a file."""
|
|
109
109
|
id: str = Field(description="The ID assigned to the uploaded file.")
|
|
110
110
|
|
|
111
111
|
|
|
@@ -151,7 +151,7 @@ class BaseClient:
|
|
|
151
151
|
self.base_url = f"{base_url.rstrip('/')}/{api_version}"
|
|
152
152
|
self.headers = {
|
|
153
153
|
"apikey": self.api_key,
|
|
154
|
-
"User-Agent": "smooth-python-sdk/0.2.
|
|
154
|
+
"User-Agent": "smooth-python-sdk/0.2.4",
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
def _handle_response(self, response: requests.Response | httpx.Response) -> dict[str, Any]:
|
|
@@ -289,19 +289,6 @@ class SmoothClient(BaseClient):
|
|
|
289
289
|
logger.error(f"Request failed: {e}")
|
|
290
290
|
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
291
291
|
|
|
292
|
-
def _upload_file(self, file: io.IOBase, name: str) -> UploadFileResponse:
|
|
293
|
-
"""Uploads a file and returns the assigned file id."""
|
|
294
|
-
try:
|
|
295
|
-
files = {
|
|
296
|
-
"file": (name, file)
|
|
297
|
-
}
|
|
298
|
-
response = self._session.post(f"{self.base_url}/upload_file", files=files)
|
|
299
|
-
data = self._handle_response(response)
|
|
300
|
-
return UploadFileResponse(**data["r"])
|
|
301
|
-
except requests.exceptions.RequestException as e:
|
|
302
|
-
logger.error(f"Request failed: {e}")
|
|
303
|
-
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
304
|
-
|
|
305
292
|
def _get_task(self, task_id: str) -> TaskResponse:
|
|
306
293
|
"""Retrieves the status and result of a task."""
|
|
307
294
|
if not task_id:
|
|
@@ -443,7 +430,25 @@ class SmoothClient(BaseClient):
|
|
|
443
430
|
ValueError: If the file doesn't exist or can't be read.
|
|
444
431
|
ApiError: If the API request fails.
|
|
445
432
|
"""
|
|
446
|
-
|
|
433
|
+
try:
|
|
434
|
+
files = {
|
|
435
|
+
"file": (name, file)
|
|
436
|
+
}
|
|
437
|
+
response = self._session.post(f"{self.base_url}/file", files=files)
|
|
438
|
+
data = self._handle_response(response)
|
|
439
|
+
return UploadFileResponse(**data["r"])
|
|
440
|
+
except requests.exceptions.RequestException as e:
|
|
441
|
+
logger.error(f"Request failed: {e}")
|
|
442
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
443
|
+
|
|
444
|
+
def delete_file(self, file_id: str):
|
|
445
|
+
"""Delete a file by its ID."""
|
|
446
|
+
try:
|
|
447
|
+
response = self._session.delete(f"{self.base_url}/file/{file_id}")
|
|
448
|
+
self._handle_response(response)
|
|
449
|
+
except requests.exceptions.RequestException as e:
|
|
450
|
+
logger.error(f"Request failed: {e}")
|
|
451
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
447
452
|
|
|
448
453
|
|
|
449
454
|
# --- Asynchronous Client ---
|
|
@@ -539,19 +544,6 @@ class SmoothAsyncClient(BaseClient):
|
|
|
539
544
|
logger.error(f"Request failed: {e}")
|
|
540
545
|
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
541
546
|
|
|
542
|
-
async def _upload_file(self, file: io.IOBase, name: str) -> UploadFileResponse:
|
|
543
|
-
"""Uploads a file and returns the assigned file id."""
|
|
544
|
-
try:
|
|
545
|
-
files = {
|
|
546
|
-
"file": (name, file)
|
|
547
|
-
}
|
|
548
|
-
response = await self._client.post(f"{self.base_url}/upload_file", files=files)
|
|
549
|
-
data = self._handle_response(response)
|
|
550
|
-
return UploadFileResponse(**data["r"])
|
|
551
|
-
except httpx.RequestError as e:
|
|
552
|
-
logger.error(f"Request failed: {e}")
|
|
553
|
-
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
554
|
-
|
|
555
547
|
async def _get_task(self, task_id: str) -> TaskResponse:
|
|
556
548
|
"""Retrieves the status and result of a task asynchronously."""
|
|
557
549
|
if not task_id:
|
|
@@ -695,7 +687,25 @@ class SmoothAsyncClient(BaseClient):
|
|
|
695
687
|
ValueError: If the file doesn't exist or can't be read.
|
|
696
688
|
ApiError: If the API request fails.
|
|
697
689
|
"""
|
|
698
|
-
|
|
690
|
+
try:
|
|
691
|
+
files = {
|
|
692
|
+
"file": (name, file)
|
|
693
|
+
}
|
|
694
|
+
response = await self._client.post(f"{self.base_url}/file", files=files)
|
|
695
|
+
data = self._handle_response(response)
|
|
696
|
+
return UploadFileResponse(**data["r"])
|
|
697
|
+
except httpx.RequestError as e:
|
|
698
|
+
logger.error(f"Request failed: {e}")
|
|
699
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
700
|
+
|
|
701
|
+
async def delete_file(self, file_id: str):
|
|
702
|
+
"""Delete a file by its ID."""
|
|
703
|
+
try:
|
|
704
|
+
response = await self._client.delete(f"{self.base_url}/file/{file_id}")
|
|
705
|
+
self._handle_response(response)
|
|
706
|
+
except httpx.RequestError as e:
|
|
707
|
+
logger.error(f"Request failed: {e}")
|
|
708
|
+
raise ApiError(status_code=0, detail=f"Request failed: {str(e)}") from None
|
|
699
709
|
|
|
700
710
|
async def close(self):
|
|
701
711
|
"""Closes the async client session."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|