grasp-sdk 0.1.9__py3-none-any.whl → 0.2.0a1__py3-none-any.whl
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 grasp-sdk might be problematic. Click here for more details.
- examples/example_async_context.py +122 -0
- examples/example_binary_file_support.py +127 -0
- examples/example_grasp_usage.py +82 -0
- examples/example_readfile_usage.py +136 -0
- examples/grasp_terminal.py +110 -0
- examples/grasp_usage.py +111 -0
- examples/test_async_context.py +64 -0
- examples/test_get_replay_screenshots.py +90 -0
- examples/test_grasp_classes.py +80 -0
- examples/test_python_script.py +160 -0
- examples/test_removed_methods.py +80 -0
- examples/test_shutdown_deprecation.py +62 -0
- examples/test_terminal_updates.py +196 -0
- grasp_sdk/__init__.py +131 -239
- grasp_sdk/grasp/__init__.py +26 -0
- grasp_sdk/grasp/browser.py +69 -0
- grasp_sdk/grasp/index.py +122 -0
- grasp_sdk/grasp/server.py +250 -0
- grasp_sdk/grasp/session.py +108 -0
- grasp_sdk/grasp/terminal.py +32 -0
- grasp_sdk/grasp/utils.py +90 -0
- grasp_sdk/models/__init__.py +1 -1
- grasp_sdk/services/__init__.py +8 -1
- grasp_sdk/services/browser.py +66 -28
- grasp_sdk/services/filesystem.py +94 -0
- grasp_sdk/services/sandbox.py +391 -20
- grasp_sdk/services/terminal.py +177 -0
- grasp_sdk/utils/auth.py +6 -8
- {grasp_sdk-0.1.9.dist-info → grasp_sdk-0.2.0a1.dist-info}/METADATA +2 -3
- grasp_sdk-0.2.0a1.dist-info/RECORD +36 -0
- {grasp_sdk-0.1.9.dist-info → grasp_sdk-0.2.0a1.dist-info}/top_level.txt +1 -0
- grasp_sdk-0.1.9.dist-info/RECORD +0 -14
- {grasp_sdk-0.1.9.dist-info → grasp_sdk-0.2.0a1.dist-info}/WHEEL +0 -0
- {grasp_sdk-0.1.9.dist-info → grasp_sdk-0.2.0a1.dist-info}/entry_points.txt +0 -0
grasp_sdk/utils/auth.py
CHANGED
|
@@ -16,8 +16,6 @@ except ImportError:
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
17
|
from aiohttp import ClientSession
|
|
18
18
|
|
|
19
|
-
from ..models import ISandboxConfig
|
|
20
|
-
|
|
21
19
|
|
|
22
20
|
class AuthError(Exception):
|
|
23
21
|
"""Exception raised for authentication errors."""
|
|
@@ -69,11 +67,11 @@ async def login(token: str) -> Dict[str, Any]:
|
|
|
69
67
|
raise AuthError(f"Unexpected error during authentication: {str(e)}")
|
|
70
68
|
|
|
71
69
|
|
|
72
|
-
async def verify(config:
|
|
73
|
-
"""Verifies the
|
|
70
|
+
async def verify(config: Dict[str, str]) -> Dict[str, Any]:
|
|
71
|
+
"""Verifies the configuration and authenticates.
|
|
74
72
|
|
|
75
73
|
Args:
|
|
76
|
-
config:
|
|
74
|
+
config: Configuration containing the API key (format: {'key': 'your-key'})
|
|
77
75
|
|
|
78
76
|
Returns:
|
|
79
77
|
Dict[str, Any]: Authentication response
|
|
@@ -82,7 +80,7 @@ async def verify(config: ISandboxConfig) -> Dict[str, Any]:
|
|
|
82
80
|
KeyVerificationError: If the key is missing or invalid
|
|
83
81
|
AuthError: If authentication fails
|
|
84
82
|
"""
|
|
85
|
-
if not config
|
|
83
|
+
if not config.get('key'):
|
|
86
84
|
raise KeyVerificationError('Grasp key is required')
|
|
87
85
|
|
|
88
86
|
try:
|
|
@@ -93,11 +91,11 @@ async def verify(config: ISandboxConfig) -> Dict[str, Any]:
|
|
|
93
91
|
raise KeyVerificationError(f"Key verification failed: {str(e)}")
|
|
94
92
|
|
|
95
93
|
|
|
96
|
-
def verify_sync(config:
|
|
94
|
+
def verify_sync(config: Dict[str, str]) -> Dict[str, Any]:
|
|
97
95
|
"""Synchronous wrapper for the verify function.
|
|
98
96
|
|
|
99
97
|
Args:
|
|
100
|
-
config:
|
|
98
|
+
config: Configuration containing the API key (format: {'key': 'your-key'})
|
|
101
99
|
|
|
102
100
|
Returns:
|
|
103
101
|
Dict[str, Any]: Authentication response
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: grasp_sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0a1
|
|
4
4
|
Summary: Python SDK for Grasp E2B - Browser automation and sandbox management
|
|
5
5
|
Home-page: https://github.com/grasp-team/grasp-e2b
|
|
6
6
|
Author: Grasp Team
|
|
@@ -27,6 +27,7 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
Requires-Dist: aiohttp>=3.9.0
|
|
28
28
|
Requires-Dist: python-dotenv>=1.0.0
|
|
29
29
|
Requires-Dist: typing-extensions>=4.8.0
|
|
30
|
+
Requires-Dist: websockets>=12.0
|
|
30
31
|
Requires-Dist: e2b>=1.5.0
|
|
31
32
|
Requires-Dist: e2b-code-interpreter>=1.5.0
|
|
32
33
|
Provides-Extra: dev
|
|
@@ -37,8 +38,6 @@ Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
|
37
38
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
39
|
Provides-Extra: browser
|
|
39
40
|
Requires-Dist: playwright>=1.40.0; extra == "browser"
|
|
40
|
-
Provides-Extra: websocket
|
|
41
|
-
Requires-Dist: websockets>=12.0; extra == "websocket"
|
|
42
41
|
Provides-Extra: validation
|
|
43
42
|
Requires-Dist: pydantic>=2.5.0; extra == "validation"
|
|
44
43
|
Dynamic: author
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
examples/example_async_context.py,sha256=W4PvU-Ck6wEc6c5L9S0i3RoeHhJ6TtqiZFRZKSVS8QU,4031
|
|
2
|
+
examples/example_binary_file_support.py,sha256=katDD0u8Wd0D3-8QbsNIK7-dnMwWQSPNdl3kqHOQgq0,4432
|
|
3
|
+
examples/example_grasp_usage.py,sha256=_mX25NLn6nF96MHU8LWq65sL5D4XSISYRDP6X3BQ48s,2731
|
|
4
|
+
examples/example_readfile_usage.py,sha256=2KM0lJoMdlroIogaZr_dIqsh_BOrc3GmY1AD2N-2nK8,4505
|
|
5
|
+
examples/grasp_terminal.py,sha256=dDstcnCs89paJ3o2SxAmHmI5_190RUzI_c8gX6aieUg,3415
|
|
6
|
+
examples/grasp_usage.py,sha256=kOq2eU51TX6C8oWXC19-JLWshCssBoc_8Y9h2Yv901Y,3806
|
|
7
|
+
examples/test_async_context.py,sha256=0iDq7ofGM8gUcH5m6MUrgLiRbaEka3mgKO-s9DWZdpM,2379
|
|
8
|
+
examples/test_get_replay_screenshots.py,sha256=fXK_lbQ7KvXC6rnLVwO_hORZXhhHLdpdOYNoDXEYaEs,2991
|
|
9
|
+
examples/test_grasp_classes.py,sha256=qeghDiw-91JN_2YerSfMLeMi4oJiJBeQ1NtlYzmK2AI,3148
|
|
10
|
+
examples/test_python_script.py,sha256=dqJSmvmrq2fdNXynJtMjqMXorrrM08ho6pFibIAZMpI,5265
|
|
11
|
+
examples/test_removed_methods.py,sha256=iW9Wxi8wRXdIffOGV_EjYOtDujOTyJoWpdMXTIExlOI,2808
|
|
12
|
+
examples/test_shutdown_deprecation.py,sha256=QbzLld_3Ur8MjOKSiOrfluW507HYtnfTbgbfwb-OYWo,2127
|
|
13
|
+
examples/test_terminal_updates.py,sha256=qh04AuM7T3TuwtOAHaH70YRY2ur88rVj3j-StlYFkQs,6688
|
|
14
|
+
grasp_sdk/__init__.py,sha256=Sjru_RR0LAOm84WY2fxpsHfcxRLI3kjmEO321Yj5t0E,5216
|
|
15
|
+
grasp_sdk/grasp/__init__.py,sha256=5i8Now_-re_FtijbkCJhQp-H_WOaV9ncj39vVjM2UKE,499
|
|
16
|
+
grasp_sdk/grasp/browser.py,sha256=wmt9W38s-__BTqBAODjvfWBg-1dGCvx4PfGTNy3Sj6U,2295
|
|
17
|
+
grasp_sdk/grasp/index.py,sha256=2p8mbrKiV0sC4YBr2ncUcF821BOOtFhh6T-aQUdR-ow,4103
|
|
18
|
+
grasp_sdk/grasp/server.py,sha256=arAYJZuJNozDuQTCX7HFgO9p9pA_TC-Sz5fz68jnKKY,8053
|
|
19
|
+
grasp_sdk/grasp/session.py,sha256=uIo5pQfyJp70fCfWSHiLow_UTVajTTJCIXjPb5IK40A,4023
|
|
20
|
+
grasp_sdk/grasp/terminal.py,sha256=7GhfhStfdKykjwgm1xQZDjlePUaEJ83Zls3QFRi5BPs,955
|
|
21
|
+
grasp_sdk/grasp/utils.py,sha256=j22tUI9yZacsdURObs-a5hxVM7sHsPBO4msRxdVb3MY,2691
|
|
22
|
+
grasp_sdk/models/__init__.py,sha256=7uza9Y0yk6rFpQmyjaw0dVDf5uvaho42biuU1RiUzYU,2636
|
|
23
|
+
grasp_sdk/services/__init__.py,sha256=tfiAU211-iMObTflMX4y4TYPU6uXr8g5J0tcc7hLzYs,540
|
|
24
|
+
grasp_sdk/services/browser.py,sha256=RPrLjK8GB92Q1ZmDr0cVooCmv8do8RgHShRY2_999As,15218
|
|
25
|
+
grasp_sdk/services/filesystem.py,sha256=XjeOgJJiPAUIBMvGLb8S9k1TBVan6ntl7Jg6PzNsGoc,3238
|
|
26
|
+
grasp_sdk/services/sandbox.py,sha256=nIR9Xb5CiwxbwneCa-i-YD60mL7UwMVO9EEhIdRuxac,35587
|
|
27
|
+
grasp_sdk/services/terminal.py,sha256=zBoWpOHxBM6Fi50SDd4fEypqBGd595UblLfp_912XBk,5807
|
|
28
|
+
grasp_sdk/utils/__init__.py,sha256=IQzRV-iZJXanSlaXBcgXBCcOXTVBCY6ZujxQpDTGW9w,816
|
|
29
|
+
grasp_sdk/utils/auth.py,sha256=W51xyswim48wy2x3xGFFOfWXFAmG4jAwh5wxDgWjKP4,7261
|
|
30
|
+
grasp_sdk/utils/config.py,sha256=NhHnUwmYOaaV_DZVep_BXsKoZPNT_-yRsiV04q83IXw,3967
|
|
31
|
+
grasp_sdk/utils/logger.py,sha256=k6WDmzL3cPTcQbiiTD4Q6fsDdUO_kyXQHz7nlmtv7G4,7228
|
|
32
|
+
grasp_sdk-0.2.0a1.dist-info/METADATA,sha256=8XBosDPayz3Im-418024HVby_0yUwiUs8-00d6T88fw,10121
|
|
33
|
+
grasp_sdk-0.2.0a1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
34
|
+
grasp_sdk-0.2.0a1.dist-info/entry_points.txt,sha256=roDjUu4JR6b1tUtRmq018mw167AbfC5zQiOtv3o6IMo,45
|
|
35
|
+
grasp_sdk-0.2.0a1.dist-info/top_level.txt,sha256=TCCFvqgXTCdDpREPkfO5su7ymn5KEA0WuzSSDjvA8Es,19
|
|
36
|
+
grasp_sdk-0.2.0a1.dist-info/RECORD,,
|
grasp_sdk-0.1.9.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
grasp_sdk/__init__.py,sha256=JEmSRZJblEfD09I_775_DMTDiEs4owE6cyVCLWr6CLc,8431
|
|
2
|
-
grasp_sdk/models/__init__.py,sha256=mUfYvCX2S9Fmir9sTsQVV7LdLIPhq2UXQs5fSTRc0eM,2619
|
|
3
|
-
grasp_sdk/services/__init__.py,sha256=HqRD-WRedLwOb2gZPXPFzI-3892VT9IknKSbuDyiss8,327
|
|
4
|
-
grasp_sdk/services/browser.py,sha256=cvp-fxKDxwLFz0evJh2FckDrNdnS8vspkZ0NgZghEzY,14003
|
|
5
|
-
grasp_sdk/services/sandbox.py,sha256=HdR5e30TW2_TPlsE6IBUIeUGnF8yssbsXGEzHrwdK58,21960
|
|
6
|
-
grasp_sdk/utils/__init__.py,sha256=IQzRV-iZJXanSlaXBcgXBCcOXTVBCY6ZujxQpDTGW9w,816
|
|
7
|
-
grasp_sdk/utils/auth.py,sha256=M_SX3uKTjjfi6fzk384IqPvUtqt98bif22HHMgio1D4,7258
|
|
8
|
-
grasp_sdk/utils/config.py,sha256=NhHnUwmYOaaV_DZVep_BXsKoZPNT_-yRsiV04q83IXw,3967
|
|
9
|
-
grasp_sdk/utils/logger.py,sha256=k6WDmzL3cPTcQbiiTD4Q6fsDdUO_kyXQHz7nlmtv7G4,7228
|
|
10
|
-
grasp_sdk-0.1.9.dist-info/METADATA,sha256=p--L6e8fH_AqboS--urzcHvrW3_sEso49r5Rl0CcJuU,10167
|
|
11
|
-
grasp_sdk-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
grasp_sdk-0.1.9.dist-info/entry_points.txt,sha256=roDjUu4JR6b1tUtRmq018mw167AbfC5zQiOtv3o6IMo,45
|
|
13
|
-
grasp_sdk-0.1.9.dist-info/top_level.txt,sha256=C9GL798_aP9Hgjq7UUlaGHLDfUohO2PSGYuGDV0cMx8,10
|
|
14
|
-
grasp_sdk-0.1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|