-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Description
sandbox = Sandbox.create(network={"allow_public_traffic": False})
sandbox.run_code("print('hello world')")---------------------------------------------------------------------------
SandboxException Traceback (most recent call last)
Cell In[3], line 1
----> 1 sandbox.run_code("print('hello world')")
File ~/Developer/brightriver-app/backend/.venv/lib/python3.11/site-packages/e2b_code_interpreter/code_interpreter_sync.py:210, in Sandbox.run_code(self, code, language, context, on_stdout, on_stderr, on_result, on_error, envs, timeout, request_timeout)
208 err = extract_exception(response)
209 if err:
--> 210 raise err
212 execution = Execution()
214 for line in response.iter_lines():
SandboxException: 403: {"sandboxId":"i7vvwx4sz8os1ddbw7rrj","message":"Sandbox is secured with traffic access token. Token header 'e2b-traffic-access-token' is missing","code":403}same for .create_code_context or any other method that sends a request to the sandbox.
according to https://e2b.dev/docs/sandbox/internet-access#restricting-public-access-to-sandbox-urls
we need to pass in traffic_access_token as e2b-traffic-access-token.
Metadata
Metadata
Assignees
Labels
No labels