Skip to content

Commit

Permalink
Add explicitly api key to reconnect method
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubno committed Feb 15, 2024
1 parent d480f58 commit 096f19b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-mugs-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@e2b/python-sdk": patch
---

Add explicitly api key to reconnect method in python SDK
9 changes: 7 additions & 2 deletions packages/python-sdk/e2b/sandbox/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ def reconnect(
on_stderr: Optional[Callable[[ProcessMessage], Any]] = None,
on_exit: Optional[Union[Callable[[int], Any], Callable[[], Any]]] = None,
timeout: Optional[float] = TIMEOUT,
**kwargs,
api_key: Optional[str] = None,
_debug_hostname: Optional[str] = None,
_debug_port: Optional[int] = None,
_debug_dev_env: Optional[Literal["remote", "local"]] = None,
):
"""
Reconnects to a previously created sandbox.
Expand All @@ -266,6 +269,8 @@ def reconnect(
:param on_stderr: A default callback that is called when stderr with a newline is received from the process
:param on_exit: A default callback that is called when the process exits
:param timeout: Timeout for sandbox to initialize in seconds, default is 60 seconds
:param api_key: The API key to use, if not provided, the `E2B_API_KEY` environment variable is used
```py
sandbox = Sandbox()
Expand All @@ -289,12 +294,12 @@ def reconnect(
on_stderr=on_stderr,
on_exit=on_exit,
timeout=timeout,
api_key=api_key,
_sandbox=models.Sandbox(
sandbox_id=sandbox_id,
client_id=client_id,
template_id=getattr(cls, "sandbox_template_id", "unknown"),
),
**kwargs,
)

def _open(
Expand Down

0 comments on commit 096f19b

Please sign in to comment.