smooth-py 0.1.1__tar.gz → 0.1.2__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.1.2/PKG-INFO +164 -0
- smooth_py-0.1.2/README.md +147 -0
- {smooth_py-0.1.1 → smooth_py-0.1.2}/pyproject.toml +2 -2
- smooth_py-0.1.2/src/smooth/__init__.py +527 -0
- smooth_py-0.1.1/PKG-INFO +0 -161
- smooth_py-0.1.1/README.md +0 -144
- smooth_py-0.1.1/src/smooth/__init__.py +0 -436
smooth_py-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: smooth-py
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Luca Pinchetti
|
|
6
|
+
Author-email: luca@circlemind.co
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: httpx (>=0.28.1,<0.29.0)
|
|
14
|
+
Requires-Dist: pydantic (>=2.11.7,<3.0.0)
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Smooth Python SDK
|
|
18
|
+
|
|
19
|
+
The Smooth Python SDK provides a convenient way to interact with the Smooth API for programmatic browser automation and task execution.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
* **Synchronous and Asynchronous Clients**: Choose between `SmoothClient` for traditional sequential programming and `SmoothAsyncClient` for high-performance asynchronous applications.
|
|
24
|
+
* **Task Management**: Easily run tasks and retrieve results upon completion.
|
|
25
|
+
* **Interactive Browser Sessions**: Get access to, interact with, and delete stateful browser sessions to manage your login credentials.
|
|
26
|
+
* **Advanced Task Configuration**: Customize task execution with options for device type, session recording, stealth mode, and proxy settings.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
You can install the Smooth Python SDK using pip:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install smooth-py
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
37
|
+
|
|
38
|
+
The SDK requires an API key for authentication. You can provide the API key in two ways:
|
|
39
|
+
|
|
40
|
+
1. **Directly in the client constructor**:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from smooth import SmoothClient
|
|
44
|
+
|
|
45
|
+
client = SmoothClient(api_key="YOUR_API_KEY")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. **As an environment variable**:
|
|
49
|
+
|
|
50
|
+
Set the `CIRCLEMIND_API_KEY` environment variable, and the client will automatically use it.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
export CIRCLEMIND_API_KEY="YOUR_API_KEY"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from smooth import SmoothClient
|
|
58
|
+
|
|
59
|
+
# The client will pick up the API key from the environment variable
|
|
60
|
+
client = SmoothClient()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
### Synchronous Client
|
|
66
|
+
|
|
67
|
+
The `SmoothClient` is ideal for scripts and applications that don't require asynchronous operations.
|
|
68
|
+
|
|
69
|
+
#### Running a Task and Waiting for the Result
|
|
70
|
+
|
|
71
|
+
The `run` method returns a `TaskHandle`. You can use the `result()` method on this handle to wait for the task to complete and get its final state.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from smooth import SmoothClient
|
|
75
|
+
from smooth.models import ApiError, TimeoutError
|
|
76
|
+
|
|
77
|
+
with SmoothClient() as client:
|
|
78
|
+
try:
|
|
79
|
+
# The run method returns a handle to the task immediately
|
|
80
|
+
task_handle = client.run(
|
|
81
|
+
task="Go to https://www.google.com and search for 'Smooth SDK'",
|
|
82
|
+
device="desktop",
|
|
83
|
+
enable_recording=True
|
|
84
|
+
)
|
|
85
|
+
print(f"Task submitted with ID: {task_handle.id}")
|
|
86
|
+
print(f"Live view available at: {task_handle.live_url}")
|
|
87
|
+
|
|
88
|
+
# The result() method waits for the task to complete
|
|
89
|
+
completed_task = task_handle.result()
|
|
90
|
+
|
|
91
|
+
if completed_task.status == "done":
|
|
92
|
+
print("Task Result:", completed_task.output)
|
|
93
|
+
print(f"View recording at: {completed_task.recording_url}")
|
|
94
|
+
else:
|
|
95
|
+
print("Task Failed:", completed_task.output)
|
|
96
|
+
|
|
97
|
+
except TimeoutError:
|
|
98
|
+
print("The task timed out.")
|
|
99
|
+
except ApiError as e:
|
|
100
|
+
print(f"An API error occurred: {e}")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Managing Browser Sessions
|
|
104
|
+
|
|
105
|
+
You can create, list, and delete browser sessions to maintain state (like logins) between tasks.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from smooth import SmoothClient
|
|
109
|
+
|
|
110
|
+
with SmoothClient() as client:
|
|
111
|
+
# Create a new browser session
|
|
112
|
+
browser_session = client.open_session()
|
|
113
|
+
print("Live URL:", browser_session.live_url)
|
|
114
|
+
print("Session ID:", browser_session.session_id)
|
|
115
|
+
|
|
116
|
+
# List all browser sessions
|
|
117
|
+
sessions = client.list_sessions()
|
|
118
|
+
print("All Session IDs:", sessions.session_ids)
|
|
119
|
+
|
|
120
|
+
# Delete the browser session
|
|
121
|
+
client.delete_session(session_id=session_id)
|
|
122
|
+
print(f"Session '{session_id}' deleted.")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Asynchronous Client
|
|
126
|
+
|
|
127
|
+
The `SmoothAsyncClient` is designed for use in asynchronous applications, such as those built with `asyncio`, to handle multiple operations concurrently without blocking.
|
|
128
|
+
|
|
129
|
+
#### Running a Task and Waiting for the Result
|
|
130
|
+
|
|
131
|
+
The `run` method returns an `AsyncTaskHandle`. Await the `result()` method on the handle to get the final task status.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
import asyncio
|
|
135
|
+
from smooth import SmoothAsyncClient
|
|
136
|
+
from smooth.models import ApiError, TimeoutError
|
|
137
|
+
|
|
138
|
+
async def main():
|
|
139
|
+
async with SmoothAsyncClient() as client:
|
|
140
|
+
try:
|
|
141
|
+
# The run method returns a handle to the task immediately
|
|
142
|
+
task_handle = await client.run(
|
|
143
|
+
task="Go to Github and search for \"smooth-sdk\""
|
|
144
|
+
)
|
|
145
|
+
print(f"Task submitted with ID: {task_handle.id}")
|
|
146
|
+
print(f"Live view available at: {task_handle.live_url}")
|
|
147
|
+
|
|
148
|
+
# The result() method waits for the task to complete
|
|
149
|
+
completed_task = await task_handle.result()
|
|
150
|
+
|
|
151
|
+
if completed_task.status == "done":
|
|
152
|
+
print("Task Result:", completed_task.output)
|
|
153
|
+
else:
|
|
154
|
+
print("Task Failed:", completed_task.output)
|
|
155
|
+
|
|
156
|
+
except TimeoutError:
|
|
157
|
+
print("The task timed out.")
|
|
158
|
+
except ApiError as e:
|
|
159
|
+
print(f"An API error occurred: {e}")
|
|
160
|
+
|
|
161
|
+
if __name__ == "__main__":
|
|
162
|
+
asyncio.run(main())
|
|
163
|
+
```
|
|
164
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Smooth Python SDK
|
|
2
|
+
|
|
3
|
+
The Smooth Python SDK provides a convenient way to interact with the Smooth API for programmatic browser automation and task execution.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
* **Synchronous and Asynchronous Clients**: Choose between `SmoothClient` for traditional sequential programming and `SmoothAsyncClient` for high-performance asynchronous applications.
|
|
8
|
+
* **Task Management**: Easily run tasks and retrieve results upon completion.
|
|
9
|
+
* **Interactive Browser Sessions**: Get access to, interact with, and delete stateful browser sessions to manage your login credentials.
|
|
10
|
+
* **Advanced Task Configuration**: Customize task execution with options for device type, session recording, stealth mode, and proxy settings.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
You can install the Smooth Python SDK using pip:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install smooth-py
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Authentication
|
|
21
|
+
|
|
22
|
+
The SDK requires an API key for authentication. You can provide the API key in two ways:
|
|
23
|
+
|
|
24
|
+
1. **Directly in the client constructor**:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from smooth import SmoothClient
|
|
28
|
+
|
|
29
|
+
client = SmoothClient(api_key="YOUR_API_KEY")
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. **As an environment variable**:
|
|
33
|
+
|
|
34
|
+
Set the `CIRCLEMIND_API_KEY` environment variable, and the client will automatically use it.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export CIRCLEMIND_API_KEY="YOUR_API_KEY"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from smooth import SmoothClient
|
|
42
|
+
|
|
43
|
+
# The client will pick up the API key from the environment variable
|
|
44
|
+
client = SmoothClient()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Synchronous Client
|
|
50
|
+
|
|
51
|
+
The `SmoothClient` is ideal for scripts and applications that don't require asynchronous operations.
|
|
52
|
+
|
|
53
|
+
#### Running a Task and Waiting for the Result
|
|
54
|
+
|
|
55
|
+
The `run` method returns a `TaskHandle`. You can use the `result()` method on this handle to wait for the task to complete and get its final state.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from smooth import SmoothClient
|
|
59
|
+
from smooth.models import ApiError, TimeoutError
|
|
60
|
+
|
|
61
|
+
with SmoothClient() as client:
|
|
62
|
+
try:
|
|
63
|
+
# The run method returns a handle to the task immediately
|
|
64
|
+
task_handle = client.run(
|
|
65
|
+
task="Go to https://www.google.com and search for 'Smooth SDK'",
|
|
66
|
+
device="desktop",
|
|
67
|
+
enable_recording=True
|
|
68
|
+
)
|
|
69
|
+
print(f"Task submitted with ID: {task_handle.id}")
|
|
70
|
+
print(f"Live view available at: {task_handle.live_url}")
|
|
71
|
+
|
|
72
|
+
# The result() method waits for the task to complete
|
|
73
|
+
completed_task = task_handle.result()
|
|
74
|
+
|
|
75
|
+
if completed_task.status == "done":
|
|
76
|
+
print("Task Result:", completed_task.output)
|
|
77
|
+
print(f"View recording at: {completed_task.recording_url}")
|
|
78
|
+
else:
|
|
79
|
+
print("Task Failed:", completed_task.output)
|
|
80
|
+
|
|
81
|
+
except TimeoutError:
|
|
82
|
+
print("The task timed out.")
|
|
83
|
+
except ApiError as e:
|
|
84
|
+
print(f"An API error occurred: {e}")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Managing Browser Sessions
|
|
88
|
+
|
|
89
|
+
You can create, list, and delete browser sessions to maintain state (like logins) between tasks.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from smooth import SmoothClient
|
|
93
|
+
|
|
94
|
+
with SmoothClient() as client:
|
|
95
|
+
# Create a new browser session
|
|
96
|
+
browser_session = client.open_session()
|
|
97
|
+
print("Live URL:", browser_session.live_url)
|
|
98
|
+
print("Session ID:", browser_session.session_id)
|
|
99
|
+
|
|
100
|
+
# List all browser sessions
|
|
101
|
+
sessions = client.list_sessions()
|
|
102
|
+
print("All Session IDs:", sessions.session_ids)
|
|
103
|
+
|
|
104
|
+
# Delete the browser session
|
|
105
|
+
client.delete_session(session_id=session_id)
|
|
106
|
+
print(f"Session '{session_id}' deleted.")
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Asynchronous Client
|
|
110
|
+
|
|
111
|
+
The `SmoothAsyncClient` is designed for use in asynchronous applications, such as those built with `asyncio`, to handle multiple operations concurrently without blocking.
|
|
112
|
+
|
|
113
|
+
#### Running a Task and Waiting for the Result
|
|
114
|
+
|
|
115
|
+
The `run` method returns an `AsyncTaskHandle`. Await the `result()` method on the handle to get the final task status.
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import asyncio
|
|
119
|
+
from smooth import SmoothAsyncClient
|
|
120
|
+
from smooth.models import ApiError, TimeoutError
|
|
121
|
+
|
|
122
|
+
async def main():
|
|
123
|
+
async with SmoothAsyncClient() as client:
|
|
124
|
+
try:
|
|
125
|
+
# The run method returns a handle to the task immediately
|
|
126
|
+
task_handle = await client.run(
|
|
127
|
+
task="Go to Github and search for \"smooth-sdk\""
|
|
128
|
+
)
|
|
129
|
+
print(f"Task submitted with ID: {task_handle.id}")
|
|
130
|
+
print(f"Live view available at: {task_handle.live_url}")
|
|
131
|
+
|
|
132
|
+
# The result() method waits for the task to complete
|
|
133
|
+
completed_task = await task_handle.result()
|
|
134
|
+
|
|
135
|
+
if completed_task.status == "done":
|
|
136
|
+
print("Task Result:", completed_task.output)
|
|
137
|
+
else:
|
|
138
|
+
print("Task Failed:", completed_task.output)
|
|
139
|
+
|
|
140
|
+
except TimeoutError:
|
|
141
|
+
print("The task timed out.")
|
|
142
|
+
except ApiError as e:
|
|
143
|
+
print(f"An API error occurred: {e}")
|
|
144
|
+
|
|
145
|
+
if __name__ == "__main__":
|
|
146
|
+
asyncio.run(main())
|
|
147
|
+
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "smooth-py"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = [
|
|
6
|
-
{name = "Luca Pinchetti",email = "
|
|
6
|
+
{name = "Luca Pinchetti",email = "luca@circlemind.co"}
|
|
7
7
|
]
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
requires-python = ">=3.10"
|