Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

[WIP] Switch API client to openapi-python-client for async support

Tomas Valenta96aeab20a471
diff --git a/packages/connect-python/cmd/protoc-gen-connect-python/main.go b/packages/connect-python/cmd/protoc-gen-connect-python/main.go
index 21273bb48..8c43514dd 100644
--- a/packages/connect-python/cmd/protoc-gen-connect-python/main.go
+++ b/packages/connect-python/cmd/protoc-gen-connect-python/main.go
@@ -304,7 +304,7 @@ func generate(gen *Plugin, file *descriptor.FileDescriptorProto) {
print(b, "# Code generated by protoc-gen-connect-python %s, DO NOT EDIT.", pluginVersion)
- print(b, "from typing import Any, Generator, Coroutine, AsyncGenerator")
+ print(b, "from typing import Any, Generator, Coroutine, AsyncGenerator, Optional")
print(b, "from httpcore import ConnectionPool, AsyncConnectionPool")
print(b, "")
@@ -325,7 +325,7 @@ func generate(gen *Plugin, file *descriptor.FileDescriptorProto) {
print(b, "")
print(b, "")
print(b, `class %s:`, getServiceClient(svc))
- print(b, " def __init__(self, base_url: str, *, pool: ConnectionPool, async_pool: AsyncConnectionPool, compressor=None, json=False, **opts):")
+ print(b, " def __init__(self, base_url: str, *, pool: Optional[ConnectionPool] = None, async_pool: Optional[AsyncConnectionPool] = None, compressor=None, json=False, **opts):")
if len(svc.Method) == 0 {
print(b, " pass")
continue
diff --git a/packages/python-sdk/Makefile b/packages/python-sdk/Makefile
index 9dbd08ec6..c99288d06 100644
--- a/packages/python-sdk/Makefile
+++ b/packages/python-sdk/Makefile
@@ -1,45 +1,8 @@
-.PHONY: generate-v2
-generate-v2:
- mv ./e2b/api/__init__.py ./e2b/api/__init__.py.bck
- rm -rf ./e2b/api/v2
- npx -yes @openapitools/openapi-generator-cli@latest version-manager set 7.1.0
- npx -yes @openapitools/openapi-generator-cli generate \
- -i ../../spec/openapi.yml \
- -g python \
- -o ./e2b/api \
- --global-property apis=sandboxes,templates,models,supportingFiles,modelDocs=false \
- --additional-properties=generateSourceCodeOnly=true \
- --additional-properties=disallowAdditionalPropertiesIfNotPresent=false \
- --additional-properties=usePydanticV2=true \
- --additional-properties=packageName=e2b.api.v2.client
- mv ./e2b/api/e2b/api/* ./e2b/api/
- rm -r ./e2b/api/e2b
- rm -r ./e2b/api/v2/client/docs
- rm -r ./e2b/api/v2/client/test
- rm -r ./e2b/api/.openapi-generator
- mv ./e2b/api/__init__.py.bck ./e2b/api/__init__.py
- black .
+generate-api:
+ openapi-python-client generate --output-path e2b/api/api --overwrite --path ../../spec/openapi.yml
+ rm -rf e2b/api/client
+ mv e2b/api/api/e2b_api_client e2b/api/client
+ rm -rf e2b/api/api
-.PHONY: generate-v1
-generate-v1:
- mv ./e2b/api/__init__.py ./e2b/api/__init__.py.bck
- rm -rf ./e2b/api/v1
- npx -yes @openapitools/openapi-generator-cli@latest version-manager set 7.1.0
- npx -yes @openapitools/openapi-generator-cli generate \
- -i ../../spec/openapi.yml \
- -g python-pydantic-v1 \
- -o ./e2b/api \
- --global-property apis=sandboxes,templates,models,supportingFiles,modelDocs=false \
- --additional-properties=generateSourceCodeOnly=true \
- --additional-properties=disallowAdditionalPropertiesIfNotPresent=false \
- --additional-properties=packageName=e2b.api.v1.client
- mv ./e2b/api/e2b/api/* ./e2b/api/
- rm -r ./e2b/api/e2b
- rm -r ./e2b/api/v1/client/docs
- rm -r ./e2b/api/v1/client/test
- rm -r ./e2b/api/.openapi-generator
- mv ./e2b/api/__init__.py.bck ./e2b/api/__init__.py
- black .
-
-.PHONY: generate
-generate: generate-v1 generate-v2
+init:
+ pip install openapi-python-client
\ No newline at end of file
diff --git a/packages/python-sdk/e2b/api/.openapi-generator-ignore b/packages/python-sdk/e2b/api/.openapi-generator-ignore
deleted file mode 100644
index 7484ee590..000000000
--- a/packages/python-sdk/e2b/api/.openapi-generator-ignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# OpenAPI Generator Ignore
-# Generated by openapi-generator https://github.com/openapitools/openapi-generator
-
-# Use this file to prevent files from being overwritten by the generator.
-# The patterns follow closely to .gitignore or .dockerignore.
-
-# As an example, the C# client generator defines ApiClient.cs.
-# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
-#ApiClient.cs
-
-# You can match any string of characters against a directory, file or extension with a single asterisk (*):
-#foo/*/qux
-# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
-
-# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
-#foo/**/qux
-# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
-
-# You can also negate patterns with an exclamation (!).
-# For example, you can ignore all files in a docs folder with the file extension .md:
-#docs/*.md
-# Then explicitly reverse the ignore rule for a single file:
-#!docs/README.md
diff --git a/packages/python-sdk/e2b/api/__init__.py b/packages/python-sdk/e2b/api/__init__.py
index 66d0c327f..248445a83 100644
--- a/packages/python-sdk/e2b/api/__init__.py
+++ b/packages/python-sdk/e2b/api/__init__.py
@@ -1,35 +1,23 @@
import json
import logging
-from importlib.metadata import version
-
+from e2b.api.client.client import AuthenticatedClient
from e2b.connection_config import ConnectionConfig
from e2b.api.metadata import default_headers
from e2b.exceptions import AuthenticationException, SandboxException
+from e2b.api.client.types import Response
logger = logging.getLogger(__name__)
-pydantic_version = version("pydantic")
-if pydantic_version < "2.0.0":
- from e2b.api.v1.client import rest
- import e2b.api.v1.client as client
- import e2b.api.v1.client.models as models
- import e2b.api.v1.client.exceptions as exceptions
-else:
- from e2b.api.v2.client import rest
- import e2b.api.v2.client as client
- import e2b.api.v2.client.models as models
- import e2b.api.v2.client.exceptions as exceptions
-
-def handle_api_exception(e: exceptions.ApiException):
- body = json.loads(e.body) if e.body else {}
+def handle_api_exception(e: Response):
+ body = json.loads(e.content) if e.content else {}
if "message" in body:
- return SandboxException(f"{e.status}: {body['message']}")
- return SandboxException(f"{e.status}: {e.body}")
+ return SandboxException(f"{e.status_code}: {body['message']}")
+ return SandboxException(f"{e.status_code}: {e.content}")
-class ApiClient(client.ApiClient):
+class ApiClient(AuthenticatedClient):
def __init__(
self,
config: ConnectionConfig,
@@ -51,28 +39,36 @@ class ApiClient(client.ApiClient):
"You can set the environment variable `E2B_ACCESS_TOKEN` or pass the `access_token` in options.",
)
- # Defining the host is optional and defaults to https://api.e2b.dev
- # See configuration.py for a list of all supported configuration parameters.
- configuration = client.Configuration(host=config.api_url)
-
- if config.api_key:
- configuration.api_key["ApiKeyAuth"] = config.api_key
- if config.access_token:
- configuration.access_token = config.access_token
-
- super().__init__(configuration, *args, **kwargs)
- self.default_headers = default_headers
-
- def call_api(self, method, url, *arg, **kwargs) -> rest.RESTResponse:
- logger.info(f"Request {method} {url}")
- response = super().call_api(method, url, *arg, **kwargs)
-
- if response.status >= 400:
- logger.error(f"Response {response.status} {response.data}")
+ token = config.access_token or config.api_key
+ if token is None:
+ raise Exception("API key or access token is required")
+
+ auth_header_name = "X-API-KEY" if config.api_key else "Authorization"
+ prefix = "Bearer" if config.access_token else ""
+
+ super().__init__(
+ base_url=config.api_url,
+ httpx_args={
+ "event_hooks": {
+ "request": [self._log_request],
+ "response": [self._log_response],
+ }
+ },
+ headers={
+ **default_headers,
+ },
+ token=token,
+ auth_header_name=auth_header_name,
+ prefix=prefix,
+ *args,
+ **kwargs,
+ )
+
+ def _log_request(self, request):
+ logger.info(f"Request {request.method} {request.url}")
+
+ def _log_response(self, response: Response):
+ if response.status_code >= 400:
+ logger.error(f"Response {response.status_code}")
else:
- logger.info(f"Response {response.status} {response.data}")
-
- return response
-
-
-__all__ = ["ApiClient", "client", "models", "exceptions"]
+ logger.info(f"Response {response.status_code}")
diff --git a/packages/python-sdk/e2b/api/client/__init__.py b/packages/python-sdk/e2b/api/client/__init__.py
new file mode 100644
index 000000000..10d90b023
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/__init__.py
@@ -0,0 +1,8 @@
+"""A client library for accessing E2B API"""
+
+from .client import AuthenticatedClient, Client
+
+__all__ = (
+ "AuthenticatedClient",
+ "Client",
+)
diff --git a/packages/python-sdk/e2b/api/client/api/__init__.py b/packages/python-sdk/e2b/api/client/api/__init__.py
new file mode 100644
index 000000000..81f9fa241
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/__init__.py
@@ -0,0 +1 @@
+"""Contains methods for accessing the API"""
diff --git a/packages/python-sdk/e2b/api/v1/__init__.py b/packages/python-sdk/e2b/api/client/api/default/__init__.py
similarity index 100%
rename from packages/python-sdk/e2b/api/v1/__init__.py
rename to packages/python-sdk/e2b/api/client/api/default/__init__.py
diff --git a/packages/python-sdk/e2b/api/client/api/default/get_health.py b/packages/python-sdk/e2b/api/client/api/default/get_health.py
new file mode 100644
index 000000000..339a6905f
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/default/get_health.py
@@ -0,0 +1,81 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...types import Response
+
+
+def _get_kwargs() -> Dict[str, Any]:
+ _kwargs: Dict[str, Any] = {
+ "method": "get",
+ "url": "/health",
+ }
+
+ return _kwargs
+
+
+def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
+ if response.status_code == HTTPStatus.OK:
+ return None
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ return None
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ *,
+ client: Union[AuthenticatedClient, Client],
+) -> Response[Any]:
+ """Health check
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs()
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio_detailed(
+ *,
+ client: Union[AuthenticatedClient, Client],
+) -> Response[Any]:
+ """Health check
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs()
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
diff --git a/packages/python-sdk/e2b/api/v2/__init__.py b/packages/python-sdk/e2b/api/client/api/sandboxes/__init__.py
similarity index 100%
rename from packages/python-sdk/e2b/api/v2/__init__.py
rename to packages/python-sdk/e2b/api/client/api/sandboxes/__init__.py
diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py b/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py
new file mode 100644
index 000000000..fa9f37750
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py
@@ -0,0 +1,99 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...types import Response
+
+
+def _get_kwargs(
+ sandbox_id: str,
+) -> Dict[str, Any]:
+ _kwargs: Dict[str, Any] = {
+ "method": "delete",
+ "url": f"/sandboxes/{sandbox_id}",
+ }
+
+ return _kwargs
+
+
+def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
+ if response.status_code == HTTPStatus.NO_CONTENT:
+ return None
+ if response.status_code == HTTPStatus.NOT_FOUND:
+ return None
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ return None
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ return None
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+) -> Response[Any]:
+ """Kill a sandbox
+
+ Args:
+ sandbox_id (str):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+) -> Response[Any]:
+ """Kill a sandbox
+
+ Args:
+ sandbox_id (str):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py
new file mode 100644
index 000000000..70bb816f7
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py
@@ -0,0 +1,140 @@
+from http import HTTPStatus
+from typing import Any, Dict, List, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.running_sandbox import RunningSandbox
+from ...types import Response
+
+
+def _get_kwargs() -> Dict[str, Any]:
+ _kwargs: Dict[str, Any] = {
+ "method": "get",
+ "url": "/sandboxes",
+ }
+
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, List["RunningSandbox"]]]:
+ if response.status_code == HTTPStatus.OK:
+ response_200 = []
+ _response_200 = response.json()
+ for response_200_item_data in _response_200:
+ response_200_item = RunningSandbox.from_dict(response_200_item_data)
+
+ response_200.append(response_200_item)
+
+ return response_200
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.BAD_REQUEST:
+ response_400 = cast(Any, None)
+ return response_400
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, List["RunningSandbox"]]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ *,
+ client: AuthenticatedClient,
+) -> Response[Union[Any, List["RunningSandbox"]]]:
+ """List all running sandboxes
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, List['RunningSandbox']]]
+ """
+
+ kwargs = _get_kwargs()
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ *,
+ client: AuthenticatedClient,
+) -> Optional[Union[Any, List["RunningSandbox"]]]:
+ """List all running sandboxes
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, List['RunningSandbox']]
+ """
+
+ return sync_detailed(
+ client=client,
+ ).parsed
+
+
+async def asyncio_detailed(
+ *,
+ client: AuthenticatedClient,
+) -> Response[Union[Any, List["RunningSandbox"]]]:
+ """List all running sandboxes
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, List['RunningSandbox']]]
+ """
+
+ kwargs = _get_kwargs()
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ *,
+ client: AuthenticatedClient,
+) -> Optional[Union[Any, List["RunningSandbox"]]]:
+ """List all running sandboxes
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, List['RunningSandbox']]
+ """
+
+ return (
+ await asyncio_detailed(
+ client=client,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py
new file mode 100644
index 000000000..97325e59b
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py
@@ -0,0 +1,195 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.sandbox_logs import SandboxLogs
+from ...types import UNSET, Response, Unset
+
+
+def _get_kwargs(
+ sandbox_id: str,
+ *,
+ start: Union[Unset, int] = UNSET,
+ limit: Union[Unset, int] = 1000,
+) -> Dict[str, Any]:
+ params: Dict[str, Any] = {}
+
+ params["start"] = start
+
+ params["limit"] = limit
+
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "get",
+ "url": f"/sandboxes/{sandbox_id}/logs",
+ "params": params,
+ }
+
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, SandboxLogs]]:
+ if response.status_code == HTTPStatus.OK:
+ response_200 = SandboxLogs.from_dict(response.json())
+
+ return response_200
+ if response.status_code == HTTPStatus.NOT_FOUND:
+ response_404 = cast(Any, None)
+ return response_404
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, SandboxLogs]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ start: Union[Unset, int] = UNSET,
+ limit: Union[Unset, int] = 1000,
+) -> Response[Union[Any, SandboxLogs]]:
+ """Get sandbox logs
+
+ Args:
+ sandbox_id (str):
+ start (Union[Unset, int]):
+ limit (Union[Unset, int]): Default: 1000.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, SandboxLogs]]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ start=start,
+ limit=limit,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ start: Union[Unset, int] = UNSET,
+ limit: Union[Unset, int] = 1000,
+) -> Optional[Union[Any, SandboxLogs]]:
+ """Get sandbox logs
+
+ Args:
+ sandbox_id (str):
+ start (Union[Unset, int]):
+ limit (Union[Unset, int]): Default: 1000.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, SandboxLogs]
+ """
+
+ return sync_detailed(
+ sandbox_id=sandbox_id,
+ client=client,
+ start=start,
+ limit=limit,
+ ).parsed
+
+
+async def asyncio_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ start: Union[Unset, int] = UNSET,
+ limit: Union[Unset, int] = 1000,
+) -> Response[Union[Any, SandboxLogs]]:
+ """Get sandbox logs
+
+ Args:
+ sandbox_id (str):
+ start (Union[Unset, int]):
+ limit (Union[Unset, int]): Default: 1000.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, SandboxLogs]]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ start=start,
+ limit=limit,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ start: Union[Unset, int] = UNSET,
+ limit: Union[Unset, int] = 1000,
+) -> Optional[Union[Any, SandboxLogs]]:
+ """Get sandbox logs
+
+ Args:
+ sandbox_id (str):
+ start (Union[Unset, int]):
+ limit (Union[Unset, int]): Default: 1000.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, SandboxLogs]
+ """
+
+ return (
+ await asyncio_detailed(
+ sandbox_id=sandbox_id,
+ client=client,
+ start=start,
+ limit=limit,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py
new file mode 100644
index 000000000..56220c047
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py
@@ -0,0 +1,169 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.new_sandbox import NewSandbox
+from ...models.sandbox import Sandbox
+from ...types import Response
+
+
+def _get_kwargs(
+ *,
+ body: NewSandbox,
+) -> Dict[str, Any]:
+ headers: Dict[str, Any] = {}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "post",
+ "url": "/sandboxes",
+ }
+
+ _body = body.to_dict()
+
+ _kwargs["json"] = _body
+ headers["Content-Type"] = "application/json"
+
+ _kwargs["headers"] = headers
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, Sandbox]]:
+ if response.status_code == HTTPStatus.CREATED:
+ response_201 = Sandbox.from_dict(response.json())
+
+ return response_201
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.BAD_REQUEST:
+ response_400 = cast(Any, None)
+ return response_400
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, Sandbox]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ *,
+ client: AuthenticatedClient,
+ body: NewSandbox,
+) -> Response[Union[Any, Sandbox]]:
+ """Create a sandbox from the template
+
+ Args:
+ body (NewSandbox):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, Sandbox]]
+ """
+
+ kwargs = _get_kwargs(
+ body=body,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ *,
+ client: AuthenticatedClient,
+ body: NewSandbox,
+) -> Optional[Union[Any, Sandbox]]:
+ """Create a sandbox from the template
+
+ Args:
+ body (NewSandbox):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, Sandbox]
+ """
+
+ return sync_detailed(
+ client=client,
+ body=body,
+ ).parsed
+
+
+async def asyncio_detailed(
+ *,
+ client: AuthenticatedClient,
+ body: NewSandbox,
+) -> Response[Union[Any, Sandbox]]:
+ """Create a sandbox from the template
+
+ Args:
+ body (NewSandbox):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, Sandbox]]
+ """
+
+ kwargs = _get_kwargs(
+ body=body,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ *,
+ client: AuthenticatedClient,
+ body: NewSandbox,
+) -> Optional[Union[Any, Sandbox]]:
+ """Create a sandbox from the template
+
+ Args:
+ body (NewSandbox):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, Sandbox]
+ """
+
+ return (
+ await asyncio_detailed(
+ client=client,
+ body=body,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py
new file mode 100644
index 000000000..163bcf177
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py
@@ -0,0 +1,114 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.post_sandboxes_sandbox_id_refreshes_body import PostSandboxesSandboxIDRefreshesBody
+from ...types import Response
+
+
+def _get_kwargs(
+ sandbox_id: str,
+ *,
+ body: PostSandboxesSandboxIDRefreshesBody,
+) -> Dict[str, Any]:
+ headers: Dict[str, Any] = {}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "post",
+ "url": f"/sandboxes/{sandbox_id}/refreshes",
+ }
+
+ _body = body.to_dict()
+
+ _kwargs["json"] = _body
+ headers["Content-Type"] = "application/json"
+
+ _kwargs["headers"] = headers
+ return _kwargs
+
+
+def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
+ if response.status_code == HTTPStatus.NO_CONTENT:
+ return None
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ return None
+ if response.status_code == HTTPStatus.NOT_FOUND:
+ return None
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: PostSandboxesSandboxIDRefreshesBody,
+) -> Response[Any]:
+ """Refresh the sandbox extending its time to live
+
+ Args:
+ sandbox_id (str):
+ body (PostSandboxesSandboxIDRefreshesBody):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ body=body,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: PostSandboxesSandboxIDRefreshesBody,
+) -> Response[Any]:
+ """Refresh the sandbox extending its time to live
+
+ Args:
+ sandbox_id (str):
+ body (PostSandboxesSandboxIDRefreshesBody):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ body=body,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py
new file mode 100644
index 000000000..148d97c87
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py
@@ -0,0 +1,120 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.post_sandboxes_sandbox_id_timeout_body import PostSandboxesSandboxIDTimeoutBody
+from ...types import Response
+
+
+def _get_kwargs(
+ sandbox_id: str,
+ *,
+ body: PostSandboxesSandboxIDTimeoutBody,
+) -> Dict[str, Any]:
+ headers: Dict[str, Any] = {}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "post",
+ "url": f"/sandboxes/{sandbox_id}/timeout",
+ }
+
+ _body = body.to_dict()
+
+ _kwargs["json"] = _body
+ headers["Content-Type"] = "application/json"
+
+ _kwargs["headers"] = headers
+ return _kwargs
+
+
+def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
+ if response.status_code == HTTPStatus.NO_CONTENT:
+ return None
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ return None
+ if response.status_code == HTTPStatus.NOT_FOUND:
+ return None
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ return None
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: PostSandboxesSandboxIDTimeoutBody,
+) -> Response[Any]:
+ """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request.
+ Calling this method multiple times overwrites the TTL, each time using the current timestamp as the
+ starting point to measure the timeout duration.
+
+ Args:
+ sandbox_id (str):
+ body (PostSandboxesSandboxIDTimeoutBody):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ body=body,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio_detailed(
+ sandbox_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: PostSandboxesSandboxIDTimeoutBody,
+) -> Response[Any]:
+ """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request.
+ Calling this method multiple times overwrites the TTL, each time using the current timestamp as the
+ starting point to measure the timeout duration.
+
+ Args:
+ sandbox_id (str):
+ body (PostSandboxesSandboxIDTimeoutBody):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ sandbox_id=sandbox_id,
+ body=body,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
diff --git a/packages/python-sdk/e2b/api/client/api/templates/__init__.py b/packages/python-sdk/e2b/api/client/api/templates/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py
new file mode 100644
index 000000000..d493420f3
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py
@@ -0,0 +1,97 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...types import Response
+
+
+def _get_kwargs(
+ template_id: str,
+) -> Dict[str, Any]:
+ _kwargs: Dict[str, Any] = {
+ "method": "delete",
+ "url": f"/templates/{template_id}",
+ }
+
+ return _kwargs
+
+
+def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
+ if response.status_code == HTTPStatus.NO_CONTENT:
+ return None
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ return None
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ return None
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ template_id: str,
+ *,
+ client: AuthenticatedClient,
+) -> Response[Any]:
+ """Delete a template
+
+ Args:
+ template_id (str):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio_detailed(
+ template_id: str,
+ *,
+ client: AuthenticatedClient,
+) -> Response[Any]:
+ """Delete a template
+
+ Args:
+ template_id (str):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates.py
new file mode 100644
index 000000000..c871c41b8
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates.py
@@ -0,0 +1,137 @@
+from http import HTTPStatus
+from typing import Any, Dict, List, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.template import Template
+from ...types import Response
+
+
+def _get_kwargs() -> Dict[str, Any]:
+ _kwargs: Dict[str, Any] = {
+ "method": "get",
+ "url": "/templates",
+ }
+
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, List["Template"]]]:
+ if response.status_code == HTTPStatus.OK:
+ response_200 = []
+ _response_200 = response.json()
+ for response_200_item_data in _response_200:
+ response_200_item = Template.from_dict(response_200_item_data)
+
+ response_200.append(response_200_item)
+
+ return response_200
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, List["Template"]]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ *,
+ client: AuthenticatedClient,
+) -> Response[Union[Any, List["Template"]]]:
+ """List all templates
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, List['Template']]]
+ """
+
+ kwargs = _get_kwargs()
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ *,
+ client: AuthenticatedClient,
+) -> Optional[Union[Any, List["Template"]]]:
+ """List all templates
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, List['Template']]
+ """
+
+ return sync_detailed(
+ client=client,
+ ).parsed
+
+
+async def asyncio_detailed(
+ *,
+ client: AuthenticatedClient,
+) -> Response[Union[Any, List["Template"]]]:
+ """List all templates
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, List['Template']]]
+ """
+
+ kwargs = _get_kwargs()
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ *,
+ client: AuthenticatedClient,
+) -> Optional[Union[Any, List["Template"]]]:
+ """List all templates
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, List['Template']]
+ """
+
+ return (
+ await asyncio_detailed(
+ client=client,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py
new file mode 100644
index 000000000..6918199ce
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py
@@ -0,0 +1,193 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.template_build import TemplateBuild
+from ...types import UNSET, Response, Unset
+
+
+def _get_kwargs(
+ template_id: str,
+ build_id: str,
+ *,
+ logs_offset: Union[Unset, int] = 0,
+) -> Dict[str, Any]:
+ params: Dict[str, Any] = {}
+
+ params["logsOffset"] = logs_offset
+
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "get",
+ "url": f"/templates/{template_id}/builds/{build_id}/status",
+ "params": params,
+ }
+
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, TemplateBuild]]:
+ if response.status_code == HTTPStatus.OK:
+ response_200 = TemplateBuild.from_dict(response.json())
+
+ return response_200
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.NOT_FOUND:
+ response_404 = cast(Any, None)
+ return response_404
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, TemplateBuild]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ template_id: str,
+ build_id: str,
+ *,
+ client: AuthenticatedClient,
+ logs_offset: Union[Unset, int] = 0,
+) -> Response[Union[Any, TemplateBuild]]:
+ """Get template build info
+
+ Args:
+ template_id (str):
+ build_id (str):
+ logs_offset (Union[Unset, int]): Default: 0.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, TemplateBuild]]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ build_id=build_id,
+ logs_offset=logs_offset,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ template_id: str,
+ build_id: str,
+ *,
+ client: AuthenticatedClient,
+ logs_offset: Union[Unset, int] = 0,
+) -> Optional[Union[Any, TemplateBuild]]:
+ """Get template build info
+
+ Args:
+ template_id (str):
+ build_id (str):
+ logs_offset (Union[Unset, int]): Default: 0.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, TemplateBuild]
+ """
+
+ return sync_detailed(
+ template_id=template_id,
+ build_id=build_id,
+ client=client,
+ logs_offset=logs_offset,
+ ).parsed
+
+
+async def asyncio_detailed(
+ template_id: str,
+ build_id: str,
+ *,
+ client: AuthenticatedClient,
+ logs_offset: Union[Unset, int] = 0,
+) -> Response[Union[Any, TemplateBuild]]:
+ """Get template build info
+
+ Args:
+ template_id (str):
+ build_id (str):
+ logs_offset (Union[Unset, int]): Default: 0.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, TemplateBuild]]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ build_id=build_id,
+ logs_offset=logs_offset,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ template_id: str,
+ build_id: str,
+ *,
+ client: AuthenticatedClient,
+ logs_offset: Union[Unset, int] = 0,
+) -> Optional[Union[Any, TemplateBuild]]:
+ """Get template build info
+
+ Args:
+ template_id (str):
+ build_id (str):
+ logs_offset (Union[Unset, int]): Default: 0.
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, TemplateBuild]
+ """
+
+ return (
+ await asyncio_detailed(
+ template_id=template_id,
+ build_id=build_id,
+ client=client,
+ logs_offset=logs_offset,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates.py
new file mode 100644
index 000000000..bf0e5bd2e
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates.py
@@ -0,0 +1,166 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.template import Template
+from ...models.template_build_request import TemplateBuildRequest
+from ...types import Response
+
+
+def _get_kwargs(
+ *,
+ body: TemplateBuildRequest,
+) -> Dict[str, Any]:
+ headers: Dict[str, Any] = {}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "post",
+ "url": "/templates",
+ }
+
+ _body = body.to_dict()
+
+ _kwargs["json"] = _body
+ headers["Content-Type"] = "application/json"
+
+ _kwargs["headers"] = headers
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, Template]]:
+ if response.status_code == HTTPStatus.ACCEPTED:
+ response_202 = Template.from_dict(response.json())
+
+ return response_202
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, Template]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Response[Union[Any, Template]]:
+ """Create a new template
+
+ Args:
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, Template]]
+ """
+
+ kwargs = _get_kwargs(
+ body=body,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Optional[Union[Any, Template]]:
+ """Create a new template
+
+ Args:
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, Template]
+ """
+
+ return sync_detailed(
+ client=client,
+ body=body,
+ ).parsed
+
+
+async def asyncio_detailed(
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Response[Union[Any, Template]]:
+ """Create a new template
+
+ Args:
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, Template]]
+ """
+
+ kwargs = _get_kwargs(
+ body=body,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Optional[Union[Any, Template]]:
+ """Create a new template
+
+ Args:
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, Template]
+ """
+
+ return (
+ await asyncio_detailed(
+ client=client,
+ body=body,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py
new file mode 100644
index 000000000..9221efb8f
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py
@@ -0,0 +1,179 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union, cast
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...models.template import Template
+from ...models.template_build_request import TemplateBuildRequest
+from ...types import Response
+
+
+def _get_kwargs(
+ template_id: str,
+ *,
+ body: TemplateBuildRequest,
+) -> Dict[str, Any]:
+ headers: Dict[str, Any] = {}
+
+ _kwargs: Dict[str, Any] = {
+ "method": "post",
+ "url": f"/templates/{template_id}",
+ }
+
+ _body = body.to_dict()
+
+ _kwargs["json"] = _body
+ headers["Content-Type"] = "application/json"
+
+ _kwargs["headers"] = headers
+ return _kwargs
+
+
+def _parse_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Optional[Union[Any, Template]]:
+ if response.status_code == HTTPStatus.ACCEPTED:
+ response_202 = Template.from_dict(response.json())
+
+ return response_202
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ response_401 = cast(Any, None)
+ return response_401
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ response_500 = cast(Any, None)
+ return response_500
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
+) -> Response[Union[Any, Template]]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ template_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Response[Union[Any, Template]]:
+ """Rebuild an template
+
+ Args:
+ template_id (str):
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, Template]]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ body=body,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+def sync(
+ template_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Optional[Union[Any, Template]]:
+ """Rebuild an template
+
+ Args:
+ template_id (str):
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, Template]
+ """
+
+ return sync_detailed(
+ template_id=template_id,
+ client=client,
+ body=body,
+ ).parsed
+
+
+async def asyncio_detailed(
+ template_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Response[Union[Any, Template]]:
+ """Rebuild an template
+
+ Args:
+ template_id (str):
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Union[Any, Template]]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ body=body,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio(
+ template_id: str,
+ *,
+ client: AuthenticatedClient,
+ body: TemplateBuildRequest,
+) -> Optional[Union[Any, Template]]:
+ """Rebuild an template
+
+ Args:
+ template_id (str):
+ body (TemplateBuildRequest):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Union[Any, Template]
+ """
+
+ return (
+ await asyncio_detailed(
+ template_id=template_id,
+ client=client,
+ body=body,
+ )
+ ).parsed
diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py
new file mode 100644
index 000000000..67e21c739
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py
@@ -0,0 +1,104 @@
+from http import HTTPStatus
+from typing import Any, Dict, Optional, Union
+
+import httpx
+
+from ... import errors
+from ...client import AuthenticatedClient, Client
+from ...types import Response
+
+
+def _get_kwargs(
+ template_id: str,
+ build_id: str,
+) -> Dict[str, Any]:
+ _kwargs: Dict[str, Any] = {
+ "method": "post",
+ "url": f"/templates/{template_id}/builds/{build_id}",
+ }
+
+ return _kwargs
+
+
+def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
+ if response.status_code == HTTPStatus.ACCEPTED:
+ return None
+ if response.status_code == HTTPStatus.UNAUTHORIZED:
+ return None
+ if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
+ return None
+ if client.raise_on_unexpected_status:
+ raise errors.UnexpectedStatus(response.status_code, response.content)
+ else:
+ return None
+
+
+def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
+ return Response(
+ status_code=HTTPStatus(response.status_code),
+ content=response.content,
+ headers=response.headers,
+ parsed=_parse_response(client=client, response=response),
+ )
+
+
+def sync_detailed(
+ template_id: str,
+ build_id: str,
+ *,
+ client: AuthenticatedClient,
+) -> Response[Any]:
+ """Start the build
+
+ Args:
+ template_id (str):
+ build_id (str):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ build_id=build_id,
+ )
+
+ response = client.get_httpx_client().request(
+ **kwargs,
+ )
+
+ return _build_response(client=client, response=response)
+
+
+async def asyncio_detailed(
+ template_id: str,
+ build_id: str,
+ *,
+ client: AuthenticatedClient,
+) -> Response[Any]:
+ """Start the build
+
+ Args:
+ template_id (str):
+ build_id (str):
+
+ Raises:
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
+
+ Returns:
+ Response[Any]
+ """
+
+ kwargs = _get_kwargs(
+ template_id=template_id,
+ build_id=build_id,
+ )
+
+ response = await client.get_async_httpx_client().request(**kwargs)
+
+ return _build_response(client=client, response=response)
diff --git a/packages/python-sdk/e2b/api/client/client.py b/packages/python-sdk/e2b/api/client/client.py
new file mode 100644
index 000000000..63a2493b9
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/client.py
@@ -0,0 +1,268 @@
+import ssl
+from typing import Any, Dict, Optional, Union
+
+import httpx
+from attrs import define, evolve, field
+
+
+@define
+class Client:
+ """A class for keeping track of data related to the API
+
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
+
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
+
+ ``cookies``: A dictionary of cookies to be sent with every request
+
+ ``headers``: A dictionary of headers to be sent with every request
+
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
+ httpx.TimeoutException if this is exceeded.
+
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
+ but can be set to False for testing purposes.
+
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
+
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
+
+
+ Attributes:
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
+ argument to the constructor.
+ """
+
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
+ _base_url: str = field(alias="base_url")
+ _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
+ _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
+ _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
+ _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
+ _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
+ _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
+ _client: Optional[httpx.Client] = field(default=None, init=False)
+ _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
+
+ def with_headers(self, headers: Dict[str, str]) -> "Client":
+ """Get a new client matching this one with additional headers"""
+ if self._client is not None:
+ self._client.headers.update(headers)
+ if self._async_client is not None:
+ self._async_client.headers.update(headers)
+ return evolve(self, headers={**self._headers, **headers})
+
+ def with_cookies(self, cookies: Dict[str, str]) -> "Client":
+ """Get a new client matching this one with additional cookies"""
+ if self._client is not None:
+ self._client.cookies.update(cookies)
+ if self._async_client is not None:
+ self._async_client.cookies.update(cookies)
+ return evolve(self, cookies={**self._cookies, **cookies})
+
+ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
+ """Get a new client matching this one with a new timeout (in seconds)"""
+ if self._client is not None:
+ self._client.timeout = timeout
+ if self._async_client is not None:
+ self._async_client.timeout = timeout
+ return evolve(self, timeout=timeout)
+
+ def set_httpx_client(self, client: httpx.Client) -> "Client":
+ """Manually the underlying httpx.Client
+
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
+ """
+ self._client = client
+ return self
+
+ def get_httpx_client(self) -> httpx.Client:
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
+ if self._client is None:
+ self._client = httpx.Client(
+ base_url=self._base_url,
+ cookies=self._cookies,
+ headers=self._headers,
+ timeout=self._timeout,
+ verify=self._verify_ssl,
+ follow_redirects=self._follow_redirects,
+ **self._httpx_args,
+ )
+ return self._client
+
+ def __enter__(self) -> "Client":
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
+ self.get_httpx_client().__enter__()
+ return self
+
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
+ self.get_httpx_client().__exit__(*args, **kwargs)
+
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
+ """Manually the underlying httpx.AsyncClient
+
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
+ """
+ self._async_client = async_client
+ return self
+
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
+ if self._async_client is None:
+ self._async_client = httpx.AsyncClient(
+ base_url=self._base_url,
+ cookies=self._cookies,
+ headers=self._headers,
+ timeout=self._timeout,
+ verify=self._verify_ssl,
+ follow_redirects=self._follow_redirects,
+ **self._httpx_args,
+ )
+ return self._async_client
+
+ async def __aenter__(self) -> "Client":
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
+ await self.get_async_httpx_client().__aenter__()
+ return self
+
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
+
+
+@define
+class AuthenticatedClient:
+ """A Client which has been authenticated for use on secured endpoints
+
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
+
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
+
+ ``cookies``: A dictionary of cookies to be sent with every request
+
+ ``headers``: A dictionary of headers to be sent with every request
+
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
+ httpx.TimeoutException if this is exceeded.
+
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
+ but can be set to False for testing purposes.
+
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
+
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
+
+
+ Attributes:
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
+ argument to the constructor.
+ token: The token to use for authentication
+ prefix: The prefix to use for the Authorization header
+ auth_header_name: The name of the Authorization header
+ """
+
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
+ _base_url: str = field(alias="base_url")
+ _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
+ _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
+ _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
+ _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
+ _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
+ _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
+ _client: Optional[httpx.Client] = field(default=None, init=False)
+ _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
+
+ token: str
+ prefix: str = "Bearer"
+ auth_header_name: str = "Authorization"
+
+ def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient":
+ """Get a new client matching this one with additional headers"""
+ if self._client is not None:
+ self._client.headers.update(headers)
+ if self._async_client is not None:
+ self._async_client.headers.update(headers)
+ return evolve(self, headers={**self._headers, **headers})
+
+ def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient":
+ """Get a new client matching this one with additional cookies"""
+ if self._client is not None:
+ self._client.cookies.update(cookies)
+ if self._async_client is not None:
+ self._async_client.cookies.update(cookies)
+ return evolve(self, cookies={**self._cookies, **cookies})
+
+ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
+ """Get a new client matching this one with a new timeout (in seconds)"""
+ if self._client is not None:
+ self._client.timeout = timeout
+ if self._async_client is not None:
+ self._async_client.timeout = timeout
+ return evolve(self, timeout=timeout)
+
+ def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
+ """Manually the underlying httpx.Client
+
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
+ """
+ self._client = client
+ return self
+
+ def get_httpx_client(self) -> httpx.Client:
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
+ if self._client is None:
+ self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
+ self._client = httpx.Client(
+ base_url=self._base_url,
+ cookies=self._cookies,
+ headers=self._headers,
+ timeout=self._timeout,
+ verify=self._verify_ssl,
+ follow_redirects=self._follow_redirects,
+ **self._httpx_args,
+ )
+ return self._client
+
+ def __enter__(self) -> "AuthenticatedClient":
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
+ self.get_httpx_client().__enter__()
+ return self
+
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
+ self.get_httpx_client().__exit__(*args, **kwargs)
+
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
+ """Manually the underlying httpx.AsyncClient
+
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
+ """
+ self._async_client = async_client
+ return self
+
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
+ if self._async_client is None:
+ self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
+ self._async_client = httpx.AsyncClient(
+ base_url=self._base_url,
+ cookies=self._cookies,
+ headers=self._headers,
+ timeout=self._timeout,
+ verify=self._verify_ssl,
+ follow_redirects=self._follow_redirects,
+ **self._httpx_args,
+ )
+ return self._async_client
+
+ async def __aenter__(self) -> "AuthenticatedClient":
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
+ await self.get_async_httpx_client().__aenter__()
+ return self
+
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
diff --git a/packages/python-sdk/e2b/api/client/errors.py b/packages/python-sdk/e2b/api/client/errors.py
new file mode 100644
index 000000000..5f92e76ac
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/errors.py
@@ -0,0 +1,16 @@
+"""Contains shared errors types that can be raised from API functions"""
+
+
+class UnexpectedStatus(Exception):
+ """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
+
+ def __init__(self, status_code: int, content: bytes):
+ self.status_code = status_code
+ self.content = content
+
+ super().__init__(
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
+ )
+
+
+__all__ = ["UnexpectedStatus"]
diff --git a/packages/python-sdk/e2b/api/client/models/__init__.py b/packages/python-sdk/e2b/api/client/models/__init__.py
new file mode 100644
index 000000000..aa3a57865
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/__init__.py
@@ -0,0 +1,29 @@
+"""Contains all the data models used in inputs/outputs"""
+
+from .error import Error
+from .new_sandbox import NewSandbox
+from .post_sandboxes_sandbox_id_refreshes_body import PostSandboxesSandboxIDRefreshesBody
+from .post_sandboxes_sandbox_id_timeout_body import PostSandboxesSandboxIDTimeoutBody
+from .running_sandbox import RunningSandbox
+from .sandbox import Sandbox
+from .sandbox_log import SandboxLog
+from .sandbox_logs import SandboxLogs
+from .template import Template
+from .template_build import TemplateBuild
+from .template_build_request import TemplateBuildRequest
+from .template_build_status import TemplateBuildStatus
+
+__all__ = (
+ "Error",
+ "NewSandbox",
+ "PostSandboxesSandboxIDRefreshesBody",
+ "PostSandboxesSandboxIDTimeoutBody",
+ "RunningSandbox",
+ "Sandbox",
+ "SandboxLog",
+ "SandboxLogs",
+ "Template",
+ "TemplateBuild",
+ "TemplateBuildRequest",
+ "TemplateBuildStatus",
+)
diff --git a/packages/python-sdk/e2b/api/client/models/error.py b/packages/python-sdk/e2b/api/client/models/error.py
new file mode 100644
index 000000000..b9680dc0c
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/error.py
@@ -0,0 +1,66 @@
+from typing import Any, Dict, List, Type, TypeVar
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+T = TypeVar("T", bound="Error")
+
+
+@_attrs_define
+class Error:
+ """
+ Attributes:
+ code (int): Error code
+ message (str): Error
+ """
+
+ code: int
+ message: str
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ code = self.code
+
+ message = self.message
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "code": code,
+ "message": message,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ code = d.pop("code")
+
+ message = d.pop("message")
+
+ error = cls(
+ code=code,
+ message=message,
+ )
+
+ error.additional_properties = d
+ return error
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/client/models/new_sandbox.py
new file mode 100644
index 000000000..46736c4e9
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/new_sandbox.py
@@ -0,0 +1,78 @@
+from typing import Any, Dict, List, Type, TypeVar, Union
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="NewSandbox")
+
+
+@_attrs_define
+class NewSandbox:
+ """
+ Attributes:
+ template_id (str): Identifier of the required template
+ timeout (Union[Unset, int]): Time to live for the sandbox in seconds. Default: 15.
+ metadata (Union[Unset, Any]):
+ """
+
+ template_id: str
+ timeout: Union[Unset, int] = 15
+ metadata: Union[Unset, Any] = UNSET
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ template_id = self.template_id
+
+ timeout = self.timeout
+
+ metadata = self.metadata
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "templateID": template_id,
+ }
+ )
+ if timeout is not UNSET:
+ field_dict["timeout"] = timeout
+ if metadata is not UNSET:
+ field_dict["metadata"] = metadata
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ template_id = d.pop("templateID")
+
+ timeout = d.pop("timeout", UNSET)
+
+ metadata = d.pop("metadata", UNSET)
+
+ new_sandbox = cls(
+ template_id=template_id,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ new_sandbox.additional_properties = d
+ return new_sandbox
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py
new file mode 100644
index 000000000..39536231a
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py
@@ -0,0 +1,58 @@
+from typing import Any, Dict, List, Type, TypeVar, Union
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="PostSandboxesSandboxIDRefreshesBody")
+
+
+@_attrs_define
+class PostSandboxesSandboxIDRefreshesBody:
+ """
+ Attributes:
+ duration (Union[Unset, int]): Duration for which the sandbox should be kept alive in seconds
+ """
+
+ duration: Union[Unset, int] = UNSET
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ duration = self.duration
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update({})
+ if duration is not UNSET:
+ field_dict["duration"] = duration
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ duration = d.pop("duration", UNSET)
+
+ post_sandboxes_sandbox_id_refreshes_body = cls(
+ duration=duration,
+ )
+
+ post_sandboxes_sandbox_id_refreshes_body.additional_properties = d
+ return post_sandboxes_sandbox_id_refreshes_body
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py
new file mode 100644
index 000000000..5d0b87607
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py
@@ -0,0 +1,58 @@
+from typing import Any, Dict, List, Type, TypeVar
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+T = TypeVar("T", bound="PostSandboxesSandboxIDTimeoutBody")
+
+
+@_attrs_define
+class PostSandboxesSandboxIDTimeoutBody:
+ """
+ Attributes:
+ timeout (int): Timeout in seconds from the current time after which the sandbox should expire
+ """
+
+ timeout: int
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ timeout = self.timeout
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "timeout": timeout,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ timeout = d.pop("timeout")
+
+ post_sandboxes_sandbox_id_timeout_body = cls(
+ timeout=timeout,
+ )
+
+ post_sandboxes_sandbox_id_timeout_body.additional_properties = d
+ return post_sandboxes_sandbox_id_timeout_body
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/running_sandbox.py b/packages/python-sdk/e2b/api/client/models/running_sandbox.py
new file mode 100644
index 000000000..831e012e6
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/running_sandbox.py
@@ -0,0 +1,120 @@
+import datetime
+from typing import Any, Dict, List, Type, TypeVar, Union
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+from dateutil.parser import isoparse
+
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="RunningSandbox")
+
+
+@_attrs_define
+class RunningSandbox:
+ """
+ Attributes:
+ template_id (str): Identifier of the template from which is the sandbox created
+ sandbox_id (str): Identifier of the sandbox
+ client_id (str): Identifier of the client
+ started_at (datetime.datetime): Time when the sandbox was started
+ cpu_count (int): CPU cores for the sandbox
+ memory_mb (int): Memory for the sandbox in MB
+ alias (Union[Unset, str]): Alias of the template
+ metadata (Union[Unset, Any]):
+ """
+
+ template_id: str
+ sandbox_id: str
+ client_id: str
+ started_at: datetime.datetime
+ cpu_count: int
+ memory_mb: int
+ alias: Union[Unset, str] = UNSET
+ metadata: Union[Unset, Any] = UNSET
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ template_id = self.template_id
+
+ sandbox_id = self.sandbox_id
+
+ client_id = self.client_id
+
+ started_at = self.started_at.isoformat()
+
+ cpu_count = self.cpu_count
+
+ memory_mb = self.memory_mb
+
+ alias = self.alias
+
+ metadata = self.metadata
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "templateID": template_id,
+ "sandboxID": sandbox_id,
+ "clientID": client_id,
+ "startedAt": started_at,
+ "cpuCount": cpu_count,
+ "memoryMB": memory_mb,
+ }
+ )
+ if alias is not UNSET:
+ field_dict["alias"] = alias
+ if metadata is not UNSET:
+ field_dict["metadata"] = metadata
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ template_id = d.pop("templateID")
+
+ sandbox_id = d.pop("sandboxID")
+
+ client_id = d.pop("clientID")
+
+ started_at = isoparse(d.pop("startedAt"))
+
+ cpu_count = d.pop("cpuCount")
+
+ memory_mb = d.pop("memoryMB")
+
+ alias = d.pop("alias", UNSET)
+
+ metadata = d.pop("metadata", UNSET)
+
+ running_sandbox = cls(
+ template_id=template_id,
+ sandbox_id=sandbox_id,
+ client_id=client_id,
+ started_at=started_at,
+ cpu_count=cpu_count,
+ memory_mb=memory_mb,
+ alias=alias,
+ metadata=metadata,
+ )
+
+ running_sandbox.additional_properties = d
+ return running_sandbox
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/sandbox.py b/packages/python-sdk/e2b/api/client/models/sandbox.py
new file mode 100644
index 000000000..a331e9a6b
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/sandbox.py
@@ -0,0 +1,93 @@
+from typing import Any, Dict, List, Type, TypeVar, Union
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="Sandbox")
+
+
+@_attrs_define
+class Sandbox:
+ """
+ Attributes:
+ template_id (str): Identifier of the template from which is the sandbox created
+ sandbox_id (str): Identifier of the sandbox
+ client_id (str): Identifier of the client
+ envd_version (str): Version of the envd running in the sandbox
+ alias (Union[Unset, str]): Alias of the template
+ """
+
+ template_id: str
+ sandbox_id: str
+ client_id: str
+ envd_version: str
+ alias: Union[Unset, str] = UNSET
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ template_id = self.template_id
+
+ sandbox_id = self.sandbox_id
+
+ client_id = self.client_id
+
+ envd_version = self.envd_version
+
+ alias = self.alias
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "templateID": template_id,
+ "sandboxID": sandbox_id,
+ "clientID": client_id,
+ "envdVersion": envd_version,
+ }
+ )
+ if alias is not UNSET:
+ field_dict["alias"] = alias
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ template_id = d.pop("templateID")
+
+ sandbox_id = d.pop("sandboxID")
+
+ client_id = d.pop("clientID")
+
+ envd_version = d.pop("envdVersion")
+
+ alias = d.pop("alias", UNSET)
+
+ sandbox = cls(
+ template_id=template_id,
+ sandbox_id=sandbox_id,
+ client_id=client_id,
+ envd_version=envd_version,
+ alias=alias,
+ )
+
+ sandbox.additional_properties = d
+ return sandbox
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log.py b/packages/python-sdk/e2b/api/client/models/sandbox_log.py
new file mode 100644
index 000000000..3e5dc9cfa
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/sandbox_log.py
@@ -0,0 +1,69 @@
+import datetime
+from typing import Any, Dict, List, Type, TypeVar
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+from dateutil.parser import isoparse
+
+T = TypeVar("T", bound="SandboxLog")
+
+
+@_attrs_define
+class SandboxLog:
+ """Log entry with timestamp and line
+
+ Attributes:
+ timestamp (datetime.datetime): Timestamp of the log entry
+ line (str): Log line content
+ """
+
+ timestamp: datetime.datetime
+ line: str
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ timestamp = self.timestamp.isoformat()
+
+ line = self.line
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "timestamp": timestamp,
+ "line": line,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ timestamp = isoparse(d.pop("timestamp"))
+
+ line = d.pop("line")
+
+ sandbox_log = cls(
+ timestamp=timestamp,
+ line=line,
+ )
+
+ sandbox_log.additional_properties = d
+ return sandbox_log
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/client/models/sandbox_logs.py
new file mode 100644
index 000000000..0594fdcc8
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/sandbox_logs.py
@@ -0,0 +1,72 @@
+from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+if TYPE_CHECKING:
+ from ..models.sandbox_log import SandboxLog
+
+
+T = TypeVar("T", bound="SandboxLogs")
+
+
+@_attrs_define
+class SandboxLogs:
+ """
+ Attributes:
+ logs (List['SandboxLog']): Logs of the sandbox
+ """
+
+ logs: List["SandboxLog"]
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ logs = []
+ for logs_item_data in self.logs:
+ logs_item = logs_item_data.to_dict()
+ logs.append(logs_item)
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "logs": logs,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ from ..models.sandbox_log import SandboxLog
+
+ d = src_dict.copy()
+ logs = []
+ _logs = d.pop("logs")
+ for logs_item_data in _logs:
+ logs_item = SandboxLog.from_dict(logs_item_data)
+
+ logs.append(logs_item)
+
+ sandbox_logs = cls(
+ logs=logs,
+ )
+
+ sandbox_logs.additional_properties = d
+ return sandbox_logs
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/template.py b/packages/python-sdk/e2b/api/client/models/template.py
new file mode 100644
index 000000000..7120815e2
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/template.py
@@ -0,0 +1,103 @@
+from typing import Any, Dict, List, Type, TypeVar, Union, cast
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="Template")
+
+
+@_attrs_define
+class Template:
+ """
+ Attributes:
+ template_id (str): Identifier of the template
+ build_id (str): Identifier of the last successful build for given template
+ cpu_count (int): CPU cores for the sandbox
+ memory_mb (int): Memory for the sandbox in MB
+ public (bool): Whether the template is public or only accessible by the team
+ aliases (Union[Unset, List[str]]): Aliases of the template
+ """
+
+ template_id: str
+ build_id: str
+ cpu_count: int
+ memory_mb: int
+ public: bool
+ aliases: Union[Unset, List[str]] = UNSET
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ template_id = self.template_id
+
+ build_id = self.build_id
+
+ cpu_count = self.cpu_count
+
+ memory_mb = self.memory_mb
+
+ public = self.public
+
+ aliases: Union[Unset, List[str]] = UNSET
+ if not isinstance(self.aliases, Unset):
+ aliases = self.aliases
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "templateID": template_id,
+ "buildID": build_id,
+ "cpuCount": cpu_count,
+ "memoryMB": memory_mb,
+ "public": public,
+ }
+ )
+ if aliases is not UNSET:
+ field_dict["aliases"] = aliases
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ template_id = d.pop("templateID")
+
+ build_id = d.pop("buildID")
+
+ cpu_count = d.pop("cpuCount")
+
+ memory_mb = d.pop("memoryMB")
+
+ public = d.pop("public")
+
+ aliases = cast(List[str], d.pop("aliases", UNSET))
+
+ template = cls(
+ template_id=template_id,
+ build_id=build_id,
+ cpu_count=cpu_count,
+ memory_mb=memory_mb,
+ public=public,
+ aliases=aliases,
+ )
+
+ template.additional_properties = d
+ return template
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/template_build.py b/packages/python-sdk/e2b/api/client/models/template_build.py
new file mode 100644
index 000000000..082e96ac3
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/template_build.py
@@ -0,0 +1,84 @@
+from typing import Any, Dict, List, Type, TypeVar, cast
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..models.template_build_status import TemplateBuildStatus
+
+T = TypeVar("T", bound="TemplateBuild")
+
+
+@_attrs_define
+class TemplateBuild:
+ """
+ Attributes:
+ logs (List[str]): Build logs
+ template_id (str): Identifier of the template
+ build_id (str): Identifier of the build
+ status (TemplateBuildStatus): Status of the template
+ """
+
+ logs: List[str]
+ template_id: str
+ build_id: str
+ status: TemplateBuildStatus
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ logs = self.logs
+
+ template_id = self.template_id
+
+ build_id = self.build_id
+
+ status = self.status.value
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "logs": logs,
+ "templateID": template_id,
+ "buildID": build_id,
+ "status": status,
+ }
+ )
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ logs = cast(List[str], d.pop("logs"))
+
+ template_id = d.pop("templateID")
+
+ build_id = d.pop("buildID")
+
+ status = TemplateBuildStatus(d.pop("status"))
+
+ template_build = cls(
+ logs=logs,
+ template_id=template_id,
+ build_id=build_id,
+ status=status,
+ )
+
+ template_build.additional_properties = d
+ return template_build
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request.py b/packages/python-sdk/e2b/api/client/models/template_build_request.py
new file mode 100644
index 000000000..6d2dfd56a
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/template_build_request.py
@@ -0,0 +1,96 @@
+from typing import Any, Dict, List, Type, TypeVar, Union
+
+from attrs import define as _attrs_define
+from attrs import field as _attrs_field
+
+from ..types import UNSET, Unset
+
+T = TypeVar("T", bound="TemplateBuildRequest")
+
+
+@_attrs_define
+class TemplateBuildRequest:
+ """
+ Attributes:
+ dockerfile (str): Dockerfile for the template
+ alias (Union[Unset, str]): Alias of the template
+ start_cmd (Union[Unset, str]): Start command to execute in the template after the build
+ cpu_count (Union[Unset, int]): CPU cores for the sandbox
+ memory_mb (Union[Unset, int]): Memory for the sandbox in MB
+ """
+
+ dockerfile: str
+ alias: Union[Unset, str] = UNSET
+ start_cmd: Union[Unset, str] = UNSET
+ cpu_count: Union[Unset, int] = UNSET
+ memory_mb: Union[Unset, int] = UNSET
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
+
+ def to_dict(self) -> Dict[str, Any]:
+ dockerfile = self.dockerfile
+
+ alias = self.alias
+
+ start_cmd = self.start_cmd
+
+ cpu_count = self.cpu_count
+
+ memory_mb = self.memory_mb
+
+ field_dict: Dict[str, Any] = {}
+ field_dict.update(self.additional_properties)
+ field_dict.update(
+ {
+ "dockerfile": dockerfile,
+ }
+ )
+ if alias is not UNSET:
+ field_dict["alias"] = alias
+ if start_cmd is not UNSET:
+ field_dict["startCmd"] = start_cmd
+ if cpu_count is not UNSET:
+ field_dict["cpuCount"] = cpu_count
+ if memory_mb is not UNSET:
+ field_dict["memoryMB"] = memory_mb
+
+ return field_dict
+
+ @classmethod
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
+ d = src_dict.copy()
+ dockerfile = d.pop("dockerfile")
+
+ alias = d.pop("alias", UNSET)
+
+ start_cmd = d.pop("startCmd", UNSET)
+
+ cpu_count = d.pop("cpuCount", UNSET)
+
+ memory_mb = d.pop("memoryMB", UNSET)
+
+ template_build_request = cls(
+ dockerfile=dockerfile,
+ alias=alias,
+ start_cmd=start_cmd,
+ cpu_count=cpu_count,
+ memory_mb=memory_mb,
+ )
+
+ template_build_request.additional_properties = d
+ return template_build_request
+
+ @property
+ def additional_keys(self) -> List[str]:
+ return list(self.additional_properties.keys())
+
+ def __getitem__(self, key: str) -> Any:
+ return self.additional_properties[key]
+
+ def __setitem__(self, key: str, value: Any) -> None:
+ self.additional_properties[key] = value
+
+ def __delitem__(self, key: str) -> None:
+ del self.additional_properties[key]
+
+ def __contains__(self, key: str) -> bool:
+ return key in self.additional_properties
diff --git a/packages/python-sdk/e2b/api/client/models/template_build_status.py b/packages/python-sdk/e2b/api/client/models/template_build_status.py
new file mode 100644
index 000000000..9ecd81941
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/models/template_build_status.py
@@ -0,0 +1,10 @@
+from enum import Enum
+
+
+class TemplateBuildStatus(str, Enum):
+ BUILDING = "building"
+ ERROR = "error"
+ READY = "ready"
+
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/packages/python-sdk/e2b/api/client/py.typed b/packages/python-sdk/e2b/api/client/py.typed
new file mode 100644
index 000000000..1aad32711
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561
\ No newline at end of file
diff --git a/packages/python-sdk/e2b/api/client/types.py b/packages/python-sdk/e2b/api/client/types.py
new file mode 100644
index 000000000..21fac106f
--- /dev/null
+++ b/packages/python-sdk/e2b/api/client/types.py
@@ -0,0 +1,45 @@
+"""Contains some shared types for properties"""
+
+from http import HTTPStatus
+from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar
+
+from attrs import define
+
+
+class Unset:
+ def __bool__(self) -> Literal[False]:
+ return False
+
+
+UNSET: Unset = Unset()
+
+FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]]
+
+
+@define
+class File:
+ """Contains information for file uploads"""
+
+ payload: BinaryIO
+ file_name: Optional[str] = None
+ mime_type: Optional[str] = None
+
+ def to_tuple(self) -> FileJsonType:
+ """Return a tuple representation that httpx will accept for multipart/form-data"""
+ return self.file_name, self.payload, self.mime_type
+
+
+T = TypeVar("T")
+
+
+@define
+class Response(Generic[T]):
+ """A response from an endpoint"""
+
+ status_code: HTTPStatus
+ content: bytes
+ headers: MutableMapping[str, str]
+ parsed: Optional[T]
+
+
+__all__ = ["File", "Response", "FileJsonType", "Unset", "UNSET"]
diff --git a/packages/python-sdk/e2b/api/v1/client/__init__.py b/packages/python-sdk/e2b/api/v1/client/__init__.py
deleted file mode 100644
index 5a151902c..000000000
--- a/packages/python-sdk/e2b/api/v1/client/__init__.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-__version__ = "1.0.0"
-
-# import apis into sdk package
-from e2b.api.v1.client.api.sandboxes_api import SandboxesApi
-
-# import ApiClient
-from e2b.api.v1.client.api_response import ApiResponse
-from e2b.api.v1.client.api_client import ApiClient
-from e2b.api.v1.client.configuration import Configuration
-from e2b.api.v1.client.exceptions import OpenApiException
-from e2b.api.v1.client.exceptions import ApiTypeError
-from e2b.api.v1.client.exceptions import ApiValueError
-from e2b.api.v1.client.exceptions import ApiKeyError
-from e2b.api.v1.client.exceptions import ApiAttributeError
-from e2b.api.v1.client.exceptions import ApiException
-
-# import models into sdk package
-from e2b.api.v1.client.models.error import Error
-from e2b.api.v1.client.models.new_sandbox import NewSandbox
-from e2b.api.v1.client.models.running_sandbox import RunningSandbox
-from e2b.api.v1.client.models.sandbox import Sandbox
-from e2b.api.v1.client.models.sandbox_log import SandboxLog
-from e2b.api.v1.client.models.sandbox_logs import SandboxLogs
-from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (
- SandboxesSandboxIDRefreshesPostRequest,
-)
-from e2b.api.v1.client.models.sandboxes_sandbox_id_timeout_post_request import (
- SandboxesSandboxIDTimeoutPostRequest,
-)
-from e2b.api.v1.client.models.template import Template
-from e2b.api.v1.client.models.template_build import TemplateBuild
-from e2b.api.v1.client.models.template_build_request import TemplateBuildRequest
diff --git a/packages/python-sdk/e2b/api/v1/client/api/__init__.py b/packages/python-sdk/e2b/api/v1/client/api/__init__.py
deleted file mode 100644
index 0471f665b..000000000
--- a/packages/python-sdk/e2b/api/v1/client/api/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# flake8: noqa
-
-# import apis into api package
-from e2b.api.v1.client.api.sandboxes_api import SandboxesApi
diff --git a/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py b/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py
deleted file mode 100644
index bfe42d76f..000000000
--- a/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py
+++ /dev/null
@@ -1,1014 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import re # noqa: F401
-import io
-import warnings
-
-from pydantic import validate_arguments, ValidationError
-
-from typing_extensions import Annotated
-from pydantic import Field, StrictStr, conint
-
-from typing import List, Optional
-
-from e2b.api.v1.client.models.new_sandbox import NewSandbox
-from e2b.api.v1.client.models.running_sandbox import RunningSandbox
-from e2b.api.v1.client.models.sandbox import Sandbox
-from e2b.api.v1.client.models.sandbox_logs import SandboxLogs
-from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (
- SandboxesSandboxIDRefreshesPostRequest,
-)
-from e2b.api.v1.client.models.sandboxes_sandbox_id_timeout_post_request import (
- SandboxesSandboxIDTimeoutPostRequest,
-)
-
-from e2b.api.v1.client.api_client import ApiClient
-from e2b.api.v1.client.api_response import ApiResponse
-from e2b.api.v1.client.exceptions import ApiTypeError, ApiValueError # noqa: F401
-
-
-class SandboxesApi:
- """NOTE: This class is auto generated by OpenAPI Generator
- Ref: https://openapi-generator.tech
-
- Do not edit the class manually.
- """
-
- def __init__(self, api_client=None) -> None:
- if api_client is None:
- api_client = ApiClient.get_default()
- self.api_client = api_client
-
- @validate_arguments
- def sandboxes_get(self, **kwargs) -> List[RunningSandbox]: # noqa: E501
- """sandboxes_get # noqa: E501
-
- List all running sandboxes # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_get(async_req=True)
- >>> result = thread.get()
-
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _request_timeout: timeout setting for this request.
- If one number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: List[RunningSandbox]
- """
- kwargs["_return_http_data_only"] = True
- if "_preload_content" in kwargs:
- message = "Error! Please call the sandboxes_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
- raise ValueError(message)
- return self.sandboxes_get_with_http_info(**kwargs) # noqa: E501
-
- @validate_arguments
- def sandboxes_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
- """sandboxes_get # noqa: E501
-
- List all running sandboxes # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_get_with_http_info(async_req=True)
- >>> result = thread.get()
-
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :type _preload_content: bool, optional
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :type _return_http_data_only: bool, optional
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_auth: dict, optional
- :type _content_type: string, optional: force content-type for the request
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: tuple(List[RunningSandbox], status_code(int), headers(HTTPHeaderDict))
- """
-
- _params = locals()
-
- _all_params = []
- _all_params.extend(
- [
- "async_req",
- "_return_http_data_only",
- "_preload_content",
- "_request_timeout",
- "_request_auth",
- "_content_type",
- "_headers",
- ]
- )
-
- # validate the arguments
- for _key, _val in _params["kwargs"].items():
- if _key not in _all_params:
- raise ApiTypeError(
- "Got an unexpected keyword argument '%s'"
- " to method sandboxes_get" % _key
- )
- _params[_key] = _val
- del _params["kwargs"]
-
- _collection_formats = {}
-
- # process the path parameters
- _path_params = {}
-
- # process the query parameters
- _query_params = []
- # process the header parameters
- _header_params = dict(_params.get("_headers", {}))
- # process the form parameters
- _form_params = []
- _files = {}
- # process the body parameter
- _body_params = None
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- ) # noqa: E501
-
- # authentication setting
- _auth_settings = ["ApiKeyAuth"] # noqa: E501
-
- _response_types_map = {
- "200": "List[RunningSandbox]",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
-
- return self.api_client.call_api(
- "/sandboxes",
- "GET",
- _path_params,
- _query_params,
- _header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- response_types_map=_response_types_map,
- auth_settings=_auth_settings,
- async_req=_params.get("async_req"),
- _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
- _preload_content=_params.get("_preload_content", True),
- _request_timeout=_params.get("_request_timeout"),
- collection_formats=_collection_formats,
- _request_auth=_params.get("_request_auth"),
- )
-
- @validate_arguments
- def sandboxes_post(
- self, new_sandbox: NewSandbox, **kwargs
- ) -> Sandbox: # noqa: E501
- """sandboxes_post # noqa: E501
-
- Create a sandbox from the template # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_post(new_sandbox, async_req=True)
- >>> result = thread.get()
-
- :param new_sandbox: (required)
- :type new_sandbox: NewSandbox
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _request_timeout: timeout setting for this request.
- If one number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: Sandbox
- """
- kwargs["_return_http_data_only"] = True
- if "_preload_content" in kwargs:
- message = "Error! Please call the sandboxes_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
- raise ValueError(message)
- return self.sandboxes_post_with_http_info(new_sandbox, **kwargs) # noqa: E501
-
- @validate_arguments
- def sandboxes_post_with_http_info(
- self, new_sandbox: NewSandbox, **kwargs
- ) -> ApiResponse: # noqa: E501
- """sandboxes_post # noqa: E501
-
- Create a sandbox from the template # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_post_with_http_info(new_sandbox, async_req=True)
- >>> result = thread.get()
-
- :param new_sandbox: (required)
- :type new_sandbox: NewSandbox
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :type _preload_content: bool, optional
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :type _return_http_data_only: bool, optional
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_auth: dict, optional
- :type _content_type: string, optional: force content-type for the request
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: tuple(Sandbox, status_code(int), headers(HTTPHeaderDict))
- """
-
- _params = locals()
-
- _all_params = ["new_sandbox"]
- _all_params.extend(
- [
- "async_req",
- "_return_http_data_only",
- "_preload_content",
- "_request_timeout",
- "_request_auth",
- "_content_type",
- "_headers",
- ]
- )
-
- # validate the arguments
- for _key, _val in _params["kwargs"].items():
- if _key not in _all_params:
- raise ApiTypeError(
- "Got an unexpected keyword argument '%s'"
- " to method sandboxes_post" % _key
- )
- _params[_key] = _val
- del _params["kwargs"]
-
- _collection_formats = {}
-
- # process the path parameters
- _path_params = {}
-
- # process the query parameters
- _query_params = []
- # process the header parameters
- _header_params = dict(_params.get("_headers", {}))
- # process the form parameters
- _form_params = []
- _files = {}
- # process the body parameter
- _body_params = None
- if _params["new_sandbox"] is not None:
- _body_params = _params["new_sandbox"]
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- ) # noqa: E501
-
- # set the HTTP header `Content-Type`
- _content_types_list = _params.get(
- "_content_type",
- self.api_client.select_header_content_type(["application/json"]),
- )
- if _content_types_list:
- _header_params["Content-Type"] = _content_types_list
-
- # authentication setting
- _auth_settings = ["ApiKeyAuth"] # noqa: E501
-
- _response_types_map = {
- "201": "Sandbox",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
-
- return self.api_client.call_api(
- "/sandboxes",
- "POST",
- _path_params,
- _query_params,
- _header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- response_types_map=_response_types_map,
- auth_settings=_auth_settings,
- async_req=_params.get("async_req"),
- _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
- _preload_content=_params.get("_preload_content", True),
- _request_timeout=_params.get("_request_timeout"),
- collection_formats=_collection_formats,
- _request_auth=_params.get("_request_auth"),
- )
-
- @validate_arguments
- def sandboxes_sandbox_id_delete(
- self, sandbox_id: StrictStr, **kwargs
- ) -> None: # noqa: E501
- """sandboxes_sandbox_id_delete # noqa: E501
-
- Kill a sandbox # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_delete(sandbox_id, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _request_timeout: timeout setting for this request.
- If one number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: None
- """
- kwargs["_return_http_data_only"] = True
- if "_preload_content" in kwargs:
- message = "Error! Please call the sandboxes_sandbox_id_delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
- raise ValueError(message)
- return self.sandboxes_sandbox_id_delete_with_http_info(
- sandbox_id, **kwargs
- ) # noqa: E501
-
- @validate_arguments
- def sandboxes_sandbox_id_delete_with_http_info(
- self, sandbox_id: StrictStr, **kwargs
- ) -> ApiResponse: # noqa: E501
- """sandboxes_sandbox_id_delete # noqa: E501
-
- Kill a sandbox # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_delete_with_http_info(sandbox_id, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :type _preload_content: bool, optional
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :type _return_http_data_only: bool, optional
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_auth: dict, optional
- :type _content_type: string, optional: force content-type for the request
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: None
- """
-
- _params = locals()
-
- _all_params = ["sandbox_id"]
- _all_params.extend(
- [
- "async_req",
- "_return_http_data_only",
- "_preload_content",
- "_request_timeout",
- "_request_auth",
- "_content_type",
- "_headers",
- ]
- )
-
- # validate the arguments
- for _key, _val in _params["kwargs"].items():
- if _key not in _all_params:
- raise ApiTypeError(
- "Got an unexpected keyword argument '%s'"
- " to method sandboxes_sandbox_id_delete" % _key
- )
- _params[_key] = _val
- del _params["kwargs"]
-
- _collection_formats = {}
-
- # process the path parameters
- _path_params = {}
- if _params["sandbox_id"] is not None:
- _path_params["sandboxID"] = _params["sandbox_id"]
-
- # process the query parameters
- _query_params = []
- # process the header parameters
- _header_params = dict(_params.get("_headers", {}))
- # process the form parameters
- _form_params = []
- _files = {}
- # process the body parameter
- _body_params = None
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- ) # noqa: E501
-
- # authentication setting
- _auth_settings = ["ApiKeyAuth"] # noqa: E501
-
- _response_types_map = {}
-
- return self.api_client.call_api(
- "/sandboxes/{sandboxID}",
- "DELETE",
- _path_params,
- _query_params,
- _header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- response_types_map=_response_types_map,
- auth_settings=_auth_settings,
- async_req=_params.get("async_req"),
- _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
- _preload_content=_params.get("_preload_content", True),
- _request_timeout=_params.get("_request_timeout"),
- collection_formats=_collection_formats,
- _request_auth=_params.get("_request_auth"),
- )
-
- @validate_arguments
- def sandboxes_sandbox_id_logs_get(
- self,
- sandbox_id: StrictStr,
- start: Annotated[
- Optional[conint(strict=True, ge=0)],
- Field(
- description="Starting timestamp of the logs that should be returned in milliseconds"
- ),
- ] = None,
- limit: Annotated[
- Optional[conint(strict=True, ge=0)],
- Field(description="Maximum number of logs that should be returned"),
- ] = None,
- **kwargs
- ) -> SandboxLogs: # noqa: E501
- """sandboxes_sandbox_id_logs_get # noqa: E501
-
- Get sandbox logs # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_logs_get(sandbox_id, start, limit, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param start: Starting timestamp of the logs that should be returned in milliseconds
- :type start: int
- :param limit: Maximum number of logs that should be returned
- :type limit: int
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _request_timeout: timeout setting for this request.
- If one number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: SandboxLogs
- """
- kwargs["_return_http_data_only"] = True
- if "_preload_content" in kwargs:
- message = "Error! Please call the sandboxes_sandbox_id_logs_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
- raise ValueError(message)
- return self.sandboxes_sandbox_id_logs_get_with_http_info(
- sandbox_id, start, limit, **kwargs
- ) # noqa: E501
-
- @validate_arguments
- def sandboxes_sandbox_id_logs_get_with_http_info(
- self,
- sandbox_id: StrictStr,
- start: Annotated[
- Optional[conint(strict=True, ge=0)],
- Field(
- description="Starting timestamp of the logs that should be returned in milliseconds"
- ),
- ] = None,
- limit: Annotated[
- Optional[conint(strict=True, ge=0)],
- Field(description="Maximum number of logs that should be returned"),
- ] = None,
- **kwargs
- ) -> ApiResponse: # noqa: E501
- """sandboxes_sandbox_id_logs_get # noqa: E501
-
- Get sandbox logs # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_logs_get_with_http_info(sandbox_id, start, limit, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param start: Starting timestamp of the logs that should be returned in milliseconds
- :type start: int
- :param limit: Maximum number of logs that should be returned
- :type limit: int
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :type _preload_content: bool, optional
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :type _return_http_data_only: bool, optional
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_auth: dict, optional
- :type _content_type: string, optional: force content-type for the request
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: tuple(SandboxLogs, status_code(int), headers(HTTPHeaderDict))
- """
-
- _params = locals()
-
- _all_params = ["sandbox_id", "start", "limit"]
- _all_params.extend(
- [
- "async_req",
- "_return_http_data_only",
- "_preload_content",
- "_request_timeout",
- "_request_auth",
- "_content_type",
- "_headers",
- ]
- )
-
- # validate the arguments
- for _key, _val in _params["kwargs"].items():
- if _key not in _all_params:
- raise ApiTypeError(
- "Got an unexpected keyword argument '%s'"
- " to method sandboxes_sandbox_id_logs_get" % _key
- )
- _params[_key] = _val
- del _params["kwargs"]
-
- _collection_formats = {}
-
- # process the path parameters
- _path_params = {}
- if _params["sandbox_id"] is not None:
- _path_params["sandboxID"] = _params["sandbox_id"]
-
- # process the query parameters
- _query_params = []
- if _params.get("start") is not None: # noqa: E501
- _query_params.append(("start", _params["start"]))
-
- if _params.get("limit") is not None: # noqa: E501
- _query_params.append(("limit", _params["limit"]))
-
- # process the header parameters
- _header_params = dict(_params.get("_headers", {}))
- # process the form parameters
- _form_params = []
- _files = {}
- # process the body parameter
- _body_params = None
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- ) # noqa: E501
-
- # authentication setting
- _auth_settings = ["ApiKeyAuth"] # noqa: E501
-
- _response_types_map = {
- "200": "SandboxLogs",
- "404": "Error",
- "401": "Error",
- "500": "Error",
- }
-
- return self.api_client.call_api(
- "/sandboxes/{sandboxID}/logs",
- "GET",
- _path_params,
- _query_params,
- _header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- response_types_map=_response_types_map,
- auth_settings=_auth_settings,
- async_req=_params.get("async_req"),
- _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
- _preload_content=_params.get("_preload_content", True),
- _request_timeout=_params.get("_request_timeout"),
- collection_formats=_collection_formats,
- _request_auth=_params.get("_request_auth"),
- )
-
- @validate_arguments
- def sandboxes_sandbox_id_refreshes_post(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_refreshes_post_request: Optional[
- SandboxesSandboxIDRefreshesPostRequest
- ] = None,
- **kwargs
- ) -> None: # noqa: E501
- """sandboxes_sandbox_id_refreshes_post # noqa: E501
-
- Refresh the sandbox extending its time to live # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_refreshes_post(sandbox_id, sandboxes_sandbox_id_refreshes_post_request, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_refreshes_post_request:
- :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _request_timeout: timeout setting for this request.
- If one number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: None
- """
- kwargs["_return_http_data_only"] = True
- if "_preload_content" in kwargs:
- message = "Error! Please call the sandboxes_sandbox_id_refreshes_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
- raise ValueError(message)
- return self.sandboxes_sandbox_id_refreshes_post_with_http_info(
- sandbox_id, sandboxes_sandbox_id_refreshes_post_request, **kwargs
- ) # noqa: E501
-
- @validate_arguments
- def sandboxes_sandbox_id_refreshes_post_with_http_info(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_refreshes_post_request: Optional[
- SandboxesSandboxIDRefreshesPostRequest
- ] = None,
- **kwargs
- ) -> ApiResponse: # noqa: E501
- """sandboxes_sandbox_id_refreshes_post # noqa: E501
-
- Refresh the sandbox extending its time to live # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_refreshes_post_with_http_info(sandbox_id, sandboxes_sandbox_id_refreshes_post_request, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_refreshes_post_request:
- :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :type _preload_content: bool, optional
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :type _return_http_data_only: bool, optional
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_auth: dict, optional
- :type _content_type: string, optional: force content-type for the request
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: None
- """
-
- _params = locals()
-
- _all_params = ["sandbox_id", "sandboxes_sandbox_id_refreshes_post_request"]
- _all_params.extend(
- [
- "async_req",
- "_return_http_data_only",
- "_preload_content",
- "_request_timeout",
- "_request_auth",
- "_content_type",
- "_headers",
- ]
- )
-
- # validate the arguments
- for _key, _val in _params["kwargs"].items():
- if _key not in _all_params:
- raise ApiTypeError(
- "Got an unexpected keyword argument '%s'"
- " to method sandboxes_sandbox_id_refreshes_post" % _key
- )
- _params[_key] = _val
- del _params["kwargs"]
-
- _collection_formats = {}
-
- # process the path parameters
- _path_params = {}
- if _params["sandbox_id"] is not None:
- _path_params["sandboxID"] = _params["sandbox_id"]
-
- # process the query parameters
- _query_params = []
- # process the header parameters
- _header_params = dict(_params.get("_headers", {}))
- # process the form parameters
- _form_params = []
- _files = {}
- # process the body parameter
- _body_params = None
- if _params["sandboxes_sandbox_id_refreshes_post_request"] is not None:
- _body_params = _params["sandboxes_sandbox_id_refreshes_post_request"]
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- ) # noqa: E501
-
- # set the HTTP header `Content-Type`
- _content_types_list = _params.get(
- "_content_type",
- self.api_client.select_header_content_type(["application/json"]),
- )
- if _content_types_list:
- _header_params["Content-Type"] = _content_types_list
-
- # authentication setting
- _auth_settings = ["ApiKeyAuth"] # noqa: E501
-
- _response_types_map = {}
-
- return self.api_client.call_api(
- "/sandboxes/{sandboxID}/refreshes",
- "POST",
- _path_params,
- _query_params,
- _header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- response_types_map=_response_types_map,
- auth_settings=_auth_settings,
- async_req=_params.get("async_req"),
- _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
- _preload_content=_params.get("_preload_content", True),
- _request_timeout=_params.get("_request_timeout"),
- collection_formats=_collection_formats,
- _request_auth=_params.get("_request_auth"),
- )
-
- @validate_arguments
- def sandboxes_sandbox_id_timeout_post(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_timeout_post_request: Optional[
- SandboxesSandboxIDTimeoutPostRequest
- ] = None,
- **kwargs
- ) -> None: # noqa: E501
- """sandboxes_sandbox_id_timeout_post # noqa: E501
-
- Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_timeout_post(sandbox_id, sandboxes_sandbox_id_timeout_post_request, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_timeout_post_request:
- :type sandboxes_sandbox_id_timeout_post_request: SandboxesSandboxIDTimeoutPostRequest
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _request_timeout: timeout setting for this request.
- If one number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: None
- """
- kwargs["_return_http_data_only"] = True
- if "_preload_content" in kwargs:
- message = "Error! Please call the sandboxes_sandbox_id_timeout_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
- raise ValueError(message)
- return self.sandboxes_sandbox_id_timeout_post_with_http_info(
- sandbox_id, sandboxes_sandbox_id_timeout_post_request, **kwargs
- ) # noqa: E501
-
- @validate_arguments
- def sandboxes_sandbox_id_timeout_post_with_http_info(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_timeout_post_request: Optional[
- SandboxesSandboxIDTimeoutPostRequest
- ] = None,
- **kwargs
- ) -> ApiResponse: # noqa: E501
- """sandboxes_sandbox_id_timeout_post # noqa: E501
-
- Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. # noqa: E501
- This method makes a synchronous HTTP request by default. To make an
- asynchronous HTTP request, please pass async_req=True
-
- >>> thread = api.sandboxes_sandbox_id_timeout_post_with_http_info(sandbox_id, sandboxes_sandbox_id_timeout_post_request, async_req=True)
- >>> result = thread.get()
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_timeout_post_request:
- :type sandboxes_sandbox_id_timeout_post_request: SandboxesSandboxIDTimeoutPostRequest
- :param async_req: Whether to execute the request asynchronously.
- :type async_req: bool, optional
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :type _preload_content: bool, optional
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :type _return_http_data_only: bool, optional
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_auth: dict, optional
- :type _content_type: string, optional: force content-type for the request
- :return: Returns the result object.
- If the method is called asynchronously,
- returns the request thread.
- :rtype: None
- """
-
- _params = locals()
-
- _all_params = ["sandbox_id", "sandboxes_sandbox_id_timeout_post_request"]
- _all_params.extend(
- [
- "async_req",
- "_return_http_data_only",
- "_preload_content",
- "_request_timeout",
- "_request_auth",
- "_content_type",
- "_headers",
- ]
- )
-
- # validate the arguments
- for _key, _val in _params["kwargs"].items():
- if _key not in _all_params:
- raise ApiTypeError(
- "Got an unexpected keyword argument '%s'"
- " to method sandboxes_sandbox_id_timeout_post" % _key
- )
- _params[_key] = _val
- del _params["kwargs"]
-
- _collection_formats = {}
-
- # process the path parameters
- _path_params = {}
- if _params["sandbox_id"] is not None:
- _path_params["sandboxID"] = _params["sandbox_id"]
-
- # process the query parameters
- _query_params = []
- # process the header parameters
- _header_params = dict(_params.get("_headers", {}))
- # process the form parameters
- _form_params = []
- _files = {}
- # process the body parameter
- _body_params = None
- if _params["sandboxes_sandbox_id_timeout_post_request"] is not None:
- _body_params = _params["sandboxes_sandbox_id_timeout_post_request"]
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- ) # noqa: E501
-
- # set the HTTP header `Content-Type`
- _content_types_list = _params.get(
- "_content_type",
- self.api_client.select_header_content_type(["application/json"]),
- )
- if _content_types_list:
- _header_params["Content-Type"] = _content_types_list
-
- # authentication setting
- _auth_settings = ["ApiKeyAuth"] # noqa: E501
-
- _response_types_map = {}
-
- return self.api_client.call_api(
- "/sandboxes/{sandboxID}/timeout",
- "POST",
- _path_params,
- _query_params,
- _header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- response_types_map=_response_types_map,
- auth_settings=_auth_settings,
- async_req=_params.get("async_req"),
- _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501
- _preload_content=_params.get("_preload_content", True),
- _request_timeout=_params.get("_request_timeout"),
- collection_formats=_collection_formats,
- _request_auth=_params.get("_request_auth"),
- )
diff --git a/packages/python-sdk/e2b/api/v1/client/api_client.py b/packages/python-sdk/e2b/api/v1/client/api_client.py
deleted file mode 100644
index 2ee64b21d..000000000
--- a/packages/python-sdk/e2b/api/v1/client/api_client.py
+++ /dev/null
@@ -1,827 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import atexit
-import datetime
-from dateutil.parser import parse
-import json
-import mimetypes
-from multiprocessing.pool import ThreadPool
-import os
-import re
-import tempfile
-
-from urllib.parse import quote
-
-from e2b.api.v1.client.configuration import Configuration
-from e2b.api.v1.client.api_response import ApiResponse
-import e2b.api.v1.client.models
-from e2b.api.v1.client import rest
-from e2b.api.v1.client.exceptions import ApiValueError, ApiException
-
-
-class ApiClient:
- """Generic API client for OpenAPI client library builds.
-
- OpenAPI generic API client. This client handles the client-
- server communication, and is invariant across implementations. Specifics of
- the methods and models for each application are generated from the OpenAPI
- templates.
-
- :param configuration: .Configuration object for this client
- :param header_name: a header to pass when making calls to the API.
- :param header_value: a header value to pass when making calls to
- the API.
- :param cookie: a cookie to include in the header when making calls
- to the API
- :param pool_threads: The number of threads to use for async requests
- to the API. More threads means more concurrent API requests.
- """
-
- PRIMITIVE_TYPES = (float, bool, bytes, str, int)
- NATIVE_TYPES_MAPPING = {
- "int": int,
- "long": int, # TODO remove as only py3 is supported?
- "float": float,
- "str": str,
- "bool": bool,
- "date": datetime.date,
- "datetime": datetime.datetime,
- "object": object,
- }
- _pool = None
-
- def __init__(
- self,
- configuration=None,
- header_name=None,
- header_value=None,
- cookie=None,
- pool_threads=1,
- ) -> None:
- # use default configuration if none is provided
- if configuration is None:
- configuration = Configuration.get_default()
- self.configuration = configuration
- self.pool_threads = pool_threads
-
- self.rest_client = rest.RESTClientObject(configuration)
- self.default_headers = {}
- if header_name is not None:
- self.default_headers[header_name] = header_value
- self.cookie = cookie
- # Set default User-Agent.
- self.user_agent = "OpenAPI-Generator/1.0.0/python"
- self.client_side_validation = configuration.client_side_validation
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_value, traceback):
- self.close()
-
- def close(self):
- if self._pool:
- self._pool.close()
- self._pool.join()
- self._pool = None
- if hasattr(atexit, "unregister"):
- atexit.unregister(self.close)
-
- @property
- def pool(self):
- """Create thread pool on first request
- avoids instantiating unused threadpool for blocking clients.
- """
- if self._pool is None:
- atexit.register(self.close)
- self._pool = ThreadPool(self.pool_threads)
- return self._pool
-
- @property
- def user_agent(self):
- """User agent for this API client"""
- return self.default_headers["User-Agent"]
-
- @user_agent.setter
- def user_agent(self, value):
- self.default_headers["User-Agent"] = value
-
- def set_default_header(self, header_name, header_value):
- self.default_headers[header_name] = header_value
-
- _default = None
-
- @classmethod
- def get_default(cls):
- """Return new instance of ApiClient.
-
- This method returns newly created, based on default constructor,
- object of ApiClient class or returns a copy of default
- ApiClient.
-
- :return: The ApiClient object.
- """
- if cls._default is None:
- cls._default = ApiClient()
- return cls._default
-
- @classmethod
- def set_default(cls, default):
- """Set default instance of ApiClient.
-
- It stores default ApiClient.
-
- :param default: object of ApiClient.
- """
- cls._default = default
-
- def __call_api(
- self,
- resource_path,
- method,
- path_params=None,
- query_params=None,
- header_params=None,
- body=None,
- post_params=None,
- files=None,
- response_types_map=None,
- auth_settings=None,
- _return_http_data_only=None,
- collection_formats=None,
- _preload_content=True,
- _request_timeout=None,
- _host=None,
- _request_auth=None,
- ):
- config = self.configuration
-
- # header parameters
- header_params = header_params or {}
- header_params.update(self.default_headers)
- if self.cookie:
- header_params["Cookie"] = self.cookie
- if header_params:
- header_params = self.sanitize_for_serialization(header_params)
- header_params = dict(
- self.parameters_to_tuples(header_params, collection_formats)
- )
-
- # path parameters
- if path_params:
- path_params = self.sanitize_for_serialization(path_params)
- path_params = self.parameters_to_tuples(path_params, collection_formats)
- for k, v in path_params:
- # specified safe chars, encode everything
- resource_path = resource_path.replace(
- "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)
- )
-
- # post parameters
- if post_params or files:
- post_params = post_params if post_params else []
- post_params = self.sanitize_for_serialization(post_params)
- post_params = self.parameters_to_tuples(post_params, collection_formats)
- post_params.extend(self.files_parameters(files))
-
- # auth setting
- self.update_params_for_auth(
- header_params,
- query_params,
- auth_settings,
- resource_path,
- method,
- body,
- request_auth=_request_auth,
- )
-
- # body
- if body:
- body = self.sanitize_for_serialization(body)
-
- # request url
- if _host is None:
- url = self.configuration.host + resource_path
- else:
- # use server/host defined in path or operation instead
- url = _host + resource_path
-
- # query parameters
- if query_params:
- query_params = self.sanitize_for_serialization(query_params)
- url_query = self.parameters_to_url_query(query_params, collection_formats)
- url += "?" + url_query
-
- try:
- # perform request and return response
- response_data = self.request(
- method,
- url,
- query_params=query_params,
- headers=header_params,
- post_params=post_params,
- body=body,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- )
- except ApiException as e:
- if e.body:
- e.body = e.body.decode("utf-8")
- raise e
-
- self.last_response = response_data
-
- return_data = None # assuming deserialization is not needed
- # data needs deserialization or returns HTTP data (deserialized) only
- if _preload_content or _return_http_data_only:
- response_type = response_types_map.get(str(response_data.status), None)
- if (
- not response_type
- and isinstance(response_data.status, int)
- and 100 <= response_data.status <= 599
- ):
- # if not found, look for '1XX', '2XX', etc.
- response_type = response_types_map.get(
- str(response_data.status)[0] + "XX", None
- )
-
- if response_type == "bytearray":
- response_data.data = response_data.data
- else:
- match = None
- content_type = response_data.getheader("content-type")
- if content_type is not None:
- match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
- encoding = match.group(1) if match else "utf-8"
- response_data.data = response_data.data.decode(encoding)
-
- # deserialize response data
- if response_type == "bytearray":
- return_data = response_data.data
- elif response_type:
- return_data = self.deserialize(response_data, response_type)
- else:
- return_data = None
-
- if _return_http_data_only:
- return return_data
- else:
- return ApiResponse(
- status_code=response_data.status,
- data=return_data,
- headers=response_data.getheaders(),
- raw_data=response_data.data,
- )
-
- def sanitize_for_serialization(self, obj):
- """Builds a JSON POST object.
-
- If obj is None, return None.
- If obj is str, int, long, float, bool, return directly.
- If obj is datetime.datetime, datetime.date
- convert to string in iso8601 format.
- If obj is list, sanitize each element in the list.
- If obj is dict, return the dict.
- If obj is OpenAPI model, return the properties dict.
-
- :param obj: The data to serialize.
- :return: The serialized form of data.
- """
- if obj is None:
- return None
- elif isinstance(obj, self.PRIMITIVE_TYPES):
- return obj
- elif isinstance(obj, list):
- return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
- elif isinstance(obj, tuple):
- return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
- elif isinstance(obj, (datetime.datetime, datetime.date)):
- return obj.isoformat()
-
- if isinstance(obj, dict):
- obj_dict = obj
- else:
- # Convert model obj to dict except
- # attributes `openapi_types`, `attribute_map`
- # and attributes which value is not None.
- # Convert attribute name to json key in
- # model definition for request.
- obj_dict = obj.to_dict()
-
- return {
- key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()
- }
-
- def deserialize(self, response, response_type):
- """Deserializes response into an object.
-
- :param response: RESTResponse object to be deserialized.
- :param response_type: class literal for
- deserialized object, or string of class name.
-
- :return: deserialized object.
- """
- # handle file downloading
- # save response body into a tmp file and return the instance
- if response_type == "file":
- return self.__deserialize_file(response)
-
- # fetch data from response object
- try:
- data = json.loads(response.data)
- except ValueError:
- data = response.data
-
- return self.__deserialize(data, response_type)
-
- def __deserialize(self, data, klass):
- """Deserializes dict, list, str into an object.
-
- :param data: dict, list or str.
- :param klass: class literal, or string of class name.
-
- :return: object.
- """
- if data is None:
- return None
-
- if isinstance(klass, str):
- if klass.startswith("List["):
- sub_kls = re.match(r"List\[(.*)]", klass).group(1)
- return [self.__deserialize(sub_data, sub_kls) for sub_data in data]
-
- if klass.startswith("Dict["):
- sub_kls = re.match(r"Dict\[([^,]*), (.*)]", klass).group(2)
- return {k: self.__deserialize(v, sub_kls) for k, v in data.items()}
-
- # convert str to class
- if klass in self.NATIVE_TYPES_MAPPING:
- klass = self.NATIVE_TYPES_MAPPING[klass]
- else:
- klass = getattr(e2b.api.v1.client.models, klass)
-
- if klass in self.PRIMITIVE_TYPES:
- return self.__deserialize_primitive(data, klass)
- elif klass == object:
- return self.__deserialize_object(data)
- elif klass == datetime.date:
- return self.__deserialize_date(data)
- elif klass == datetime.datetime:
- return self.__deserialize_datetime(data)
- else:
- return self.__deserialize_model(data, klass)
-
- def call_api(
- self,
- resource_path,
- method,
- path_params=None,
- query_params=None,
- header_params=None,
- body=None,
- post_params=None,
- files=None,
- response_types_map=None,
- auth_settings=None,
- async_req=None,
- _return_http_data_only=None,
- collection_formats=None,
- _preload_content=True,
- _request_timeout=None,
- _host=None,
- _request_auth=None,
- ):
- """Makes the HTTP request (synchronous) and returns deserialized data.
-
- To make an async_req request, set the async_req parameter.
-
- :param resource_path: Path to method endpoint.
- :param method: Method to call.
- :param path_params: Path parameters in the url.
- :param query_params: Query parameters in the url.
- :param header_params: Header parameters to be
- placed in the request header.
- :param body: Request body.
- :param post_params dict: Request post form parameters,
- for `application/x-www-form-urlencoded`, `multipart/form-data`.
- :param auth_settings list: Auth Settings names for the request.
- :param response: Response data type.
- :param files dict: key -> filename, value -> filepath,
- for `multipart/form-data`.
- :param async_req bool: execute request asynchronously
- :param _return_http_data_only: response data instead of ApiResponse
- object with status code, headers, etc
- :param _preload_content: if False, the ApiResponse.data will
- be set to none and raw_data will store the
- HTTP response body without reading/decoding.
- Default is True.
- :param collection_formats: dict of collection formats for path, query,
- header, and post parameters.
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :type _request_token: dict, optional
- :return:
- If async_req parameter is True,
- the request will be called asynchronously.
- The method will return the request thread.
- If parameter async_req is False or missing,
- then the method will return the response directly.
- """
- args = (
- resource_path,
- method,
- path_params,
- query_params,
- header_params,
- body,
- post_params,
- files,
- response_types_map,
- auth_settings,
- _return_http_data_only,
- collection_formats,
- _preload_content,
- _request_timeout,
- _host,
- _request_auth,
- )
- if not async_req:
- return self.__call_api(*args)
-
- return self.pool.apply_async(self.__call_api, args)
-
- def request(
- self,
- method,
- url,
- query_params=None,
- headers=None,
- post_params=None,
- body=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- """Makes the HTTP request using RESTClient."""
- if method == "GET":
- return self.rest_client.get_request(
- url,
- query_params=query_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- headers=headers,
- )
- elif method == "HEAD":
- return self.rest_client.head_request(
- url,
- query_params=query_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- headers=headers,
- )
- elif method == "OPTIONS":
- return self.rest_client.options_request(
- url,
- query_params=query_params,
- headers=headers,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- )
- elif method == "POST":
- return self.rest_client.post_request(
- url,
- query_params=query_params,
- headers=headers,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
- elif method == "PUT":
- return self.rest_client.put_request(
- url,
- query_params=query_params,
- headers=headers,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
- elif method == "PATCH":
- return self.rest_client.patch_request(
- url,
- query_params=query_params,
- headers=headers,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
- elif method == "DELETE":
- return self.rest_client.delete_request(
- url,
- query_params=query_params,
- headers=headers,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
- else:
- raise ApiValueError(
- "http method must be `GET`, `HEAD`, `OPTIONS`,"
- " `POST`, `PATCH`, `PUT` or `DELETE`."
- )
-
- def parameters_to_tuples(self, params, collection_formats):
- """Get parameters as list of tuples, formatting collections.
-
- :param params: Parameters as dict or list of two-tuples
- :param dict collection_formats: Parameter collection formats
- :return: Parameters as list of tuples, collections formatted
- """
- new_params = []
- if collection_formats is None:
- collection_formats = {}
- for k, v in (
- params.items() if isinstance(params, dict) else params
- ): # noqa: E501
- if k in collection_formats:
- collection_format = collection_formats[k]
- if collection_format == "multi":
- new_params.extend((k, value) for value in v)
- else:
- if collection_format == "ssv":
- delimiter = " "
- elif collection_format == "tsv":
- delimiter = "\t"
- elif collection_format == "pipes":
- delimiter = "|"
- else: # csv is the default
- delimiter = ","
- new_params.append((k, delimiter.join(str(value) for value in v)))
- else:
- new_params.append((k, v))
- return new_params
-
- def parameters_to_url_query(self, params, collection_formats):
- """Get parameters as list of tuples, formatting collections.
-
- :param params: Parameters as dict or list of two-tuples
- :param dict collection_formats: Parameter collection formats
- :return: URL query string (e.g. a=Hello%20World&b=123)
- """
- new_params = []
- if collection_formats is None:
- collection_formats = {}
- for k, v in (
- params.items() if isinstance(params, dict) else params
- ): # noqa: E501
- if isinstance(v, bool):
- v = str(v).lower()
- if isinstance(v, (int, float)):
- v = str(v)
- if isinstance(v, dict):
- v = json.dumps(v)
-
- if k in collection_formats:
- collection_format = collection_formats[k]
- if collection_format == "multi":
- new_params.extend((k, value) for value in v)
- else:
- if collection_format == "ssv":
- delimiter = " "
- elif collection_format == "tsv":
- delimiter = "\t"
- elif collection_format == "pipes":
- delimiter = "|"
- else: # csv is the default
- delimiter = ","
- new_params.append(
- (k, delimiter.join(quote(str(value)) for value in v))
- )
- else:
- new_params.append((k, quote(str(v))))
-
- return "&".join(["=".join(item) for item in new_params])
-
- def files_parameters(self, files=None):
- """Builds form parameters.
-
- :param files: File parameters.
- :return: Form parameters with files.
- """
- params = []
-
- if files:
- for k, v in files.items():
- if not v:
- continue
- file_names = v if type(v) is list else [v]
- for n in file_names:
- with open(n, "rb") as f:
- filename = os.path.basename(f.name)
- filedata = f.read()
- mimetype = (
- mimetypes.guess_type(filename)[0]
- or "application/octet-stream"
- )
- params.append(tuple([k, tuple([filename, filedata, mimetype])]))
-
- return params
-
- def select_header_accept(self, accepts):
- """Returns `Accept` based on an array of accepts provided.
-
- :param accepts: List of headers.
- :return: Accept (e.g. application/json).
- """
- if not accepts:
- return
-
- for accept in accepts:
- if re.search("json", accept, re.IGNORECASE):
- return accept
-
- return accepts[0]
-
- def select_header_content_type(self, content_types):
- """Returns `Content-Type` based on an array of content_types provided.
-
- :param content_types: List of content-types.
- :return: Content-Type (e.g. application/json).
- """
- if not content_types:
- return None
-
- for content_type in content_types:
- if re.search("json", content_type, re.IGNORECASE):
- return content_type
-
- return content_types[0]
-
- def update_params_for_auth(
- self,
- headers,
- queries,
- auth_settings,
- resource_path,
- method,
- body,
- request_auth=None,
- ):
- """Updates header and query params based on authentication setting.
-
- :param headers: Header parameters dict to be updated.
- :param queries: Query parameters tuple list to be updated.
- :param auth_settings: Authentication setting identifiers list.
- :resource_path: A string representation of the HTTP request resource path.
- :method: A string representation of the HTTP request method.
- :body: A object representing the body of the HTTP request.
- The object type is the return value of sanitize_for_serialization().
- :param request_auth: if set, the provided settings will
- override the token in the configuration.
- """
- if not auth_settings:
- return
-
- if request_auth:
- self._apply_auth_params(
- headers, queries, resource_path, method, body, request_auth
- )
- return
-
- for auth in auth_settings:
- auth_setting = self.configuration.auth_settings().get(auth)
- if auth_setting:
- self._apply_auth_params(
- headers, queries, resource_path, method, body, auth_setting
- )
-
- def _apply_auth_params(
- self, headers, queries, resource_path, method, body, auth_setting
- ):
- """Updates the request parameters based on a single auth_setting
-
- :param headers: Header parameters dict to be updated.
- :param queries: Query parameters tuple list to be updated.
- :resource_path: A string representation of the HTTP request resource path.
- :method: A string representation of the HTTP request method.
- :body: A object representing the body of the HTTP request.
- The object type is the return value of sanitize_for_serialization().
- :param auth_setting: auth settings for the endpoint
- """
- if auth_setting["in"] == "cookie":
- headers["Cookie"] = auth_setting["value"]
- elif auth_setting["in"] == "header":
- if auth_setting["type"] != "http-signature":
- headers[auth_setting["key"]] = auth_setting["value"]
- elif auth_setting["in"] == "query":
- queries.append((auth_setting["key"], auth_setting["value"]))
- else:
- raise ApiValueError("Authentication token must be in `query` or `header`")
-
- def __deserialize_file(self, response):
- """Deserializes body to file
-
- Saves response body into a file in a temporary folder,
- using the filename from the `Content-Disposition` header if provided.
-
- :param response: RESTResponse.
- :return: file path.
- """
- fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
- os.close(fd)
- os.remove(path)
-
- content_disposition = response.getheader("Content-Disposition")
- if content_disposition:
- filename = re.search(
- r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition
- ).group(1)
- path = os.path.join(os.path.dirname(path), filename)
-
- with open(path, "wb") as f:
- f.write(response.data)
-
- return path
-
- def __deserialize_primitive(self, data, klass):
- """Deserializes string to primitive type.
-
- :param data: str.
- :param klass: class literal.
-
- :return: int, long, float, str, bool.
- """
- try:
- return klass(data)
- except UnicodeEncodeError:
- return str(data)
- except TypeError:
- return data
-
- def __deserialize_object(self, value):
- """Return an original value.
-
- :return: object.
- """
- return value
-
- def __deserialize_date(self, string):
- """Deserializes string to date.
-
- :param string: str.
- :return: date.
- """
- try:
- return parse(string).date()
- except ImportError:
- return string
- except ValueError:
- raise rest.ApiException(
- status=0, reason="Failed to parse `{0}` as date object".format(string)
- )
-
- def __deserialize_datetime(self, string):
- """Deserializes string to datetime.
-
- The string should be in iso8601 datetime format.
-
- :param string: str.
- :return: datetime.
- """
- try:
- return parse(string)
- except ImportError:
- return string
- except ValueError:
- raise rest.ApiException(
- status=0,
- reason=("Failed to parse `{0}` as datetime object".format(string)),
- )
-
- def __deserialize_model(self, data, klass):
- """Deserializes list or dict to model.
-
- :param data: dict, list.
- :param klass: class literal.
- :return: model object.
- """
-
- return klass.from_dict(data)
diff --git a/packages/python-sdk/e2b/api/v1/client/api_response.py b/packages/python-sdk/e2b/api/v1/client/api_response.py
deleted file mode 100644
index bb7e40032..000000000
--- a/packages/python-sdk/e2b/api/v1/client/api_response.py
+++ /dev/null
@@ -1,28 +0,0 @@
-"""API response object."""
-
-from __future__ import annotations
-from typing import Any, Dict, Optional
-from pydantic import Field, StrictInt, StrictStr
-
-
-class ApiResponse:
- """
- API response object
- """
-
- status_code: Optional[StrictInt] = Field(None, description="HTTP status code")
- headers: Optional[Dict[StrictStr, StrictStr]] = Field(
- None, description="HTTP headers"
- )
- data: Optional[Any] = Field(
- None, description="Deserialized data given the data type"
- )
- raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)")
-
- def __init__(
- self, status_code=None, headers=None, data=None, raw_data=None
- ) -> None:
- self.status_code = status_code
- self.headers = headers
- self.data = data
- self.raw_data = raw_data
diff --git a/packages/python-sdk/e2b/api/v1/client/configuration.py b/packages/python-sdk/e2b/api/v1/client/configuration.py
deleted file mode 100644
index 49efca49a..000000000
--- a/packages/python-sdk/e2b/api/v1/client/configuration.py
+++ /dev/null
@@ -1,489 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import copy
-import logging
-import multiprocessing
-import sys
-import urllib3
-
-import http.client as httplib
-
-JSON_SCHEMA_VALIDATION_KEYWORDS = {
- "multipleOf",
- "maximum",
- "exclusiveMaximum",
- "minimum",
- "exclusiveMinimum",
- "maxLength",
- "minLength",
- "pattern",
- "maxItems",
- "minItems",
-}
-
-
-class Configuration:
- """This class contains various settings of the API client.
-
- :param host: Base url.
- :param api_key: Dict to store API key(s).
- Each entry in the dict specifies an API key.
- The dict key is the name of the security scheme in the OAS specification.
- The dict value is the API key secret.
- :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
- The dict key is the name of the security scheme in the OAS specification.
- The dict value is an API key prefix when generating the auth data.
- :param username: Username for HTTP basic authentication.
- :param password: Password for HTTP basic authentication.
- :param access_token: Access token.
- :param server_index: Index to servers configuration.
- :param server_variables: Mapping with string values to replace variables in
- templated server configuration. The validation of enums is performed for
- variables with defined enum values before.
- :param server_operation_index: Mapping from operation ID to an index to server
- configuration.
- :param server_operation_variables: Mapping from operation ID to a mapping with
- string values to replace variables in templated server configuration.
- The validation of enums is performed for variables with defined enum
- values before.
- :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
- in PEM format.
-
- :Example:
-
- API Key Authentication Example.
- Given the following security scheme in the OpenAPI specification:
- components:
- securitySchemes:
- cookieAuth: # name for the security scheme
- type: apiKey
- in: cookie
- name: JSESSIONID # cookie name
-
- You can programmatically set the cookie:
-
- conf = e2b.api.v1.client.Configuration(
- api_key={'cookieAuth': 'abc123'}
- api_key_prefix={'cookieAuth': 'JSESSIONID'}
- )
-
- The following cookie will be added to the HTTP request:
- Cookie: JSESSIONID abc123
- """
-
- _default = None
-
- def __init__(
- self,
- host=None,
- api_key=None,
- api_key_prefix=None,
- username=None,
- password=None,
- access_token=None,
- server_index=None,
- server_variables=None,
- server_operation_index=None,
- server_operation_variables=None,
- ssl_ca_cert=None,
- ) -> None:
- """Constructor"""
- self._base_path = "https://api.e2b.dev" if host is None else host
- """Default Base url
- """
- self.server_index = 0 if server_index is None and host is None else server_index
- self.server_operation_index = server_operation_index or {}
- """Default server index
- """
- self.server_variables = server_variables or {}
- self.server_operation_variables = server_operation_variables or {}
- """Default server variables
- """
- self.temp_folder_path = None
- """Temp file folder for downloading files
- """
- # Authentication Settings
- self.api_key = {}
- if api_key:
- self.api_key = api_key
- """dict to store API key(s)
- """
- self.api_key_prefix = {}
- if api_key_prefix:
- self.api_key_prefix = api_key_prefix
- """dict to store API prefix (e.g. Bearer)
- """
- self.refresh_api_key_hook = None
- """function hook to refresh API key if expired
- """
- self.username = username
- """Username for HTTP basic authentication
- """
- self.password = password
- """Password for HTTP basic authentication
- """
- self.access_token = access_token
- """Access token
- """
- self.logger = {}
- """Logging Settings
- """
- self.logger["package_logger"] = logging.getLogger("e2b.api.v1.client")
- self.logger["urllib3_logger"] = logging.getLogger("urllib3")
- self.logger_format = "%(asctime)s %(levelname)s %(message)s"
- """Log format
- """
- self.logger_stream_handler = None
- """Log stream handler
- """
- self.logger_file_handler = None
- """Log file handler
- """
- self.logger_file = None
- """Debug file location
- """
- self.debug = False
- """Debug switch
- """
-
- self.verify_ssl = True
- """SSL/TLS verification
- Set this to false to skip verifying SSL certificate when calling API
- from https server.
- """
- self.ssl_ca_cert = ssl_ca_cert
- """Set this to customize the certificate file to verify the peer.
- """
- self.cert_file = None
- """client certificate file
- """
- self.key_file = None
- """client key file
- """
- self.assert_hostname = None
- """Set this to True/False to enable/disable SSL hostname verification.
- """
- self.tls_server_name = None
- """SSL/TLS Server Name Indication (SNI)
- Set this to the SNI value expected by the server.
- """
-
- self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
- """urllib3 connection pool's maximum number of connections saved
- per pool. urllib3 uses 1 connection as default value, but this is
- not the best value when you are making a lot of possibly parallel
- requests to the same host, which is often the case here.
- cpu_count * 5 is used as default value to increase performance.
- """
-
- self.proxy = None
- """Proxy URL
- """
- self.proxy_headers = None
- """Proxy headers
- """
- self.safe_chars_for_path_param = ""
- """Safe chars for path_param
- """
- self.retries = None
- """Adding retries to override urllib3 default value 3
- """
- # Enable client side validation
- self.client_side_validation = True
-
- self.socket_options = None
- """Options to pass down to the underlying urllib3 socket
- """
-
- self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
- """datetime format
- """
-
- self.date_format = "%Y-%m-%d"
- """date format
- """
-
- def __deepcopy__(self, memo):
- cls = self.__class__
- result = cls.__new__(cls)
- memo[id(self)] = result
- for k, v in self.__dict__.items():
- if k not in ("logger", "logger_file_handler"):
- setattr(result, k, copy.deepcopy(v, memo))
- # shallow copy of loggers
- result.logger = copy.copy(self.logger)
- # use setters to configure loggers
- result.logger_file = self.logger_file
- result.debug = self.debug
- return result
-
- def __setattr__(self, name, value):
- object.__setattr__(self, name, value)
-
- @classmethod
- def set_default(cls, default):
- """Set default instance of configuration.
-
- It stores default configuration, which can be
- returned by get_default_copy method.
-
- :param default: object of Configuration
- """
- cls._default = default
-
- @classmethod
- def get_default_copy(cls):
- """Deprecated. Please use `get_default` instead.
-
- Deprecated. Please use `get_default` instead.
-
- :return: The configuration object.
- """
- return cls.get_default()
-
- @classmethod
- def get_default(cls):
- """Return the default configuration.
-
- This method returns newly created, based on default constructor,
- object of Configuration class or returns a copy of default
- configuration.
-
- :return: The configuration object.
- """
- if cls._default is None:
- cls._default = Configuration()
- return cls._default
-
- @property
- def logger_file(self):
- """The logger file.
-
- If the logger_file is None, then add stream handler and remove file
- handler. Otherwise, add file handler and remove stream handler.
-
- :param value: The logger_file path.
- :type: str
- """
- return self.__logger_file
-
- @logger_file.setter
- def logger_file(self, value):
- """The logger file.
-
- If the logger_file is None, then add stream handler and remove file
- handler. Otherwise, add file handler and remove stream handler.
-
- :param value: The logger_file path.
- :type: str
- """
- self.__logger_file = value
- if self.__logger_file:
- # If set logging file,
- # then add file handler and remove stream handler.
- self.logger_file_handler = logging.FileHandler(self.__logger_file)
- self.logger_file_handler.setFormatter(self.logger_formatter)
- for _, logger in self.logger.items():
- logger.addHandler(self.logger_file_handler)
-
- @property
- def debug(self):
- """Debug status
-
- :param value: The debug status, True or False.
- :type: bool
- """
- return self.__debug
-
- @debug.setter
- def debug(self, value):
- """Debug status
-
- :param value: The debug status, True or False.
- :type: bool
- """
- self.__debug = value
- if self.__debug:
- # if debug status is True, turn on debug logging
- for _, logger in self.logger.items():
- logger.setLevel(logging.DEBUG)
- # turn on httplib debug
- httplib.HTTPConnection.debuglevel = 1
- else:
- # if debug status is False, turn off debug logging,
- # setting log level to default `logging.WARNING`
- for _, logger in self.logger.items():
- logger.setLevel(logging.WARNING)
- # turn off httplib debug
- httplib.HTTPConnection.debuglevel = 0
-
- @property
- def logger_format(self):
- """The logger format.
-
- The logger_formatter will be updated when sets logger_format.
-
- :param value: The format string.
- :type: str
- """
- return self.__logger_format
-
- @logger_format.setter
- def logger_format(self, value):
- """The logger format.
-
- The logger_formatter will be updated when sets logger_format.
-
- :param value: The format string.
- :type: str
- """
- self.__logger_format = value
- self.logger_formatter = logging.Formatter(self.__logger_format)
-
- def get_api_key_with_prefix(self, identifier, alias=None):
- """Gets API key (with prefix if set).
-
- :param identifier: The identifier of apiKey.
- :param alias: The alternative identifier of apiKey.
- :return: The token for api key authentication.
- """
- if self.refresh_api_key_hook is not None:
- self.refresh_api_key_hook(self)
- key = self.api_key.get(
- identifier, self.api_key.get(alias) if alias is not None else None
- )
- if key:
- prefix = self.api_key_prefix.get(identifier)
- if prefix:
- return "%s %s" % (prefix, key)
- else:
- return key
-
- def get_basic_auth_token(self):
- """Gets HTTP basic authentication header (string).
-
- :return: The token for basic HTTP authentication.
- """
- username = ""
- if self.username is not None:
- username = self.username
- password = ""
- if self.password is not None:
- password = self.password
- return urllib3.util.make_headers(basic_auth=username + ":" + password).get(
- "authorization"
- )
-
- def auth_settings(self):
- """Gets Auth Settings dict for api client.
-
- :return: The Auth Settings information dict.
- """
- auth = {}
- if "ApiKeyAuth" in self.api_key:
- auth["ApiKeyAuth"] = {
- "type": "api_key",
- "in": "header",
- "key": "X-API-Key",
- "value": self.get_api_key_with_prefix(
- "ApiKeyAuth",
- ),
- }
- if self.access_token is not None:
- auth["AccessTokenAuth"] = {
- "type": "bearer",
- "in": "header",
- "format": "access_token",
- "key": "Authorization",
- "value": "Bearer " + self.access_token,
- }
- return auth
-
- def to_debug_report(self):
- """Gets the essential information for debugging.
-
- :return: The report for debugging.
- """
- return (
- "Python SDK Debug Report:\n"
- "OS: {env}\n"
- "Python Version: {pyversion}\n"
- "Version of the API: 0.1.0\n"
- "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version)
- )
-
- def get_host_settings(self):
- """Gets an array of host settings
-
- :return: An array of host settings
- """
- return [
- {
- "url": "https://api.e2b.dev",
- "description": "No description provided",
- }
- ]
-
- def get_host_from_settings(self, index, variables=None, servers=None):
- """Gets host URL based on the index and variables
- :param index: array index of the host settings
- :param variables: hash of variable and the corresponding value
- :param servers: an array of host settings or None
- :return: URL based on host settings
- """
- if index is None:
- return self._base_path
-
- variables = {} if variables is None else variables
- servers = self.get_host_settings() if servers is None else servers
-
- try:
- server = servers[index]
- except IndexError:
- raise ValueError(
- "Invalid index {0} when selecting the host settings. "
- "Must be less than {1}".format(index, len(servers))
- )
-
- url = server["url"]
-
- # go through variables and replace placeholders
- for variable_name, variable in server.get("variables", {}).items():
- used_value = variables.get(variable_name, variable["default_value"])
-
- if "enum_values" in variable and used_value not in variable["enum_values"]:
- raise ValueError(
- "The variable `{0}` in the host URL has invalid value "
- "{1}. Must be {2}.".format(
- variable_name, variables[variable_name], variable["enum_values"]
- )
- )
-
- url = url.replace("{" + variable_name + "}", used_value)
-
- return url
-
- @property
- def host(self):
- """Return generated host."""
- return self.get_host_from_settings(
- self.server_index, variables=self.server_variables
- )
-
- @host.setter
- def host(self, value):
- """Fix base path."""
- self._base_path = value
- self.server_index = None
diff --git a/packages/python-sdk/e2b/api/v1/client/exceptions.py b/packages/python-sdk/e2b/api/v1/client/exceptions.py
deleted file mode 100644
index 5a56914c5..000000000
--- a/packages/python-sdk/e2b/api/v1/client/exceptions.py
+++ /dev/null
@@ -1,161 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-class OpenApiException(Exception):
- """The base exception class for all OpenAPIExceptions"""
-
-
-class ApiTypeError(OpenApiException, TypeError):
- def __init__(
- self, msg, path_to_item=None, valid_classes=None, key_type=None
- ) -> None:
- """Raises an exception for TypeErrors
-
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (list): a list of keys an indices to get to the
- current_item
- None if unset
- valid_classes (tuple): the primitive classes that current item
- should be an instance of
- None if unset
- key_type (bool): False if our value is a value in a dict
- True if it is a key in a dict
- False if our item is an item in a list
- None if unset
- """
- self.path_to_item = path_to_item
- self.valid_classes = valid_classes
- self.key_type = key_type
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiTypeError, self).__init__(full_msg)
-
-
-class ApiValueError(OpenApiException, ValueError):
- def __init__(self, msg, path_to_item=None) -> None:
- """
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (list) the path to the exception in the
- received_data dict. None if unset
- """
-
- self.path_to_item = path_to_item
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiValueError, self).__init__(full_msg)
-
-
-class ApiAttributeError(OpenApiException, AttributeError):
- def __init__(self, msg, path_to_item=None) -> None:
- """
- Raised when an attribute reference or assignment fails.
-
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (None/list) the path to the exception in the
- received_data dict
- """
- self.path_to_item = path_to_item
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiAttributeError, self).__init__(full_msg)
-
-
-class ApiKeyError(OpenApiException, KeyError):
- def __init__(self, msg, path_to_item=None) -> None:
- """
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (None/list) the path to the exception in the
- received_data dict
- """
- self.path_to_item = path_to_item
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiKeyError, self).__init__(full_msg)
-
-
-class ApiException(OpenApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- if http_resp:
- self.status = http_resp.status
- self.reason = http_resp.reason
- self.body = http_resp.data
- self.headers = http_resp.getheaders()
- else:
- self.status = status
- self.reason = reason
- self.body = None
- self.headers = None
-
- def __str__(self):
- """Custom error messages for exception"""
- error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
- if self.headers:
- error_message += "HTTP response headers: {0}\n".format(self.headers)
-
- if self.body:
- error_message += "HTTP response body: {0}\n".format(self.body)
-
- return error_message
-
-
-class BadRequestException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(BadRequestException, self).__init__(status, reason, http_resp)
-
-
-class NotFoundException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(NotFoundException, self).__init__(status, reason, http_resp)
-
-
-class UnauthorizedException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(UnauthorizedException, self).__init__(status, reason, http_resp)
-
-
-class ForbiddenException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(ForbiddenException, self).__init__(status, reason, http_resp)
-
-
-class ServiceException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(ServiceException, self).__init__(status, reason, http_resp)
-
-
-def render_path(path_to_item):
- """Returns a string representation of a path"""
- result = ""
- for pth in path_to_item:
- if isinstance(pth, int):
- result += "[{0}]".format(pth)
- else:
- result += "['{0}']".format(pth)
- return result
diff --git a/packages/python-sdk/e2b/api/v1/client/models/__init__.py b/packages/python-sdk/e2b/api/v1/client/models/__init__.py
deleted file mode 100644
index 28033b32e..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-# import models into model package
-from e2b.api.v1.client.models.error import Error
-from e2b.api.v1.client.models.new_sandbox import NewSandbox
-from e2b.api.v1.client.models.running_sandbox import RunningSandbox
-from e2b.api.v1.client.models.sandbox import Sandbox
-from e2b.api.v1.client.models.sandbox_log import SandboxLog
-from e2b.api.v1.client.models.sandbox_logs import SandboxLogs
-from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (
- SandboxesSandboxIDRefreshesPostRequest,
-)
-from e2b.api.v1.client.models.sandboxes_sandbox_id_timeout_post_request import (
- SandboxesSandboxIDTimeoutPostRequest,
-)
-from e2b.api.v1.client.models.template import Template
-from e2b.api.v1.client.models.template_build import TemplateBuild
-from e2b.api.v1.client.models.template_build_request import TemplateBuildRequest
diff --git a/packages/python-sdk/e2b/api/v1/client/models/error.py b/packages/python-sdk/e2b/api/v1/client/models/error.py
deleted file mode 100644
index 8545189ec..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/error.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict
-from pydantic import BaseModel, Field, StrictInt, StrictStr
-
-
-class Error(BaseModel):
- """
- Error
- """
-
- code: StrictInt = Field(..., description="Error code")
- message: StrictStr = Field(..., description="Error")
- additional_properties: Dict[str, Any] = {}
- __properties = ["code", "message"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Error:
- """Create an instance of Error from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> Error:
- """Create an instance of Error from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return Error.parse_obj(obj)
-
- _obj = Error.parse_obj({"code": obj.get("code"), "message": obj.get("message")})
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/v1/client/models/new_sandbox.py
deleted file mode 100644
index e8fba9c91..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/new_sandbox.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, Optional
-from pydantic import BaseModel, Field, StrictStr, conint
-
-
-class NewSandbox(BaseModel):
- """
- NewSandbox
- """
-
- template_id: StrictStr = Field(
- ..., alias="templateID", description="Identifier of the required template"
- )
- timeout: Optional[conint(strict=True, ge=0)] = Field(
- 15, description="Time to live for the sandbox in seconds."
- )
- metadata: Optional[Dict[str, StrictStr]] = None
- additional_properties: Dict[str, Any] = {}
- __properties = ["templateID", "timeout", "metadata"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> NewSandbox:
- """Create an instance of NewSandbox from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> NewSandbox:
- """Create an instance of NewSandbox from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return NewSandbox.parse_obj(obj)
-
- _obj = NewSandbox.parse_obj(
- {
- "template_id": obj.get("templateID"),
- "timeout": obj.get("timeout") if obj.get("timeout") is not None else 15,
- "metadata": obj.get("metadata"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/running_sandbox.py b/packages/python-sdk/e2b/api/v1/client/models/running_sandbox.py
deleted file mode 100644
index fe123da8f..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/running_sandbox.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-from datetime import datetime
-from typing import Any, Dict, Optional
-from pydantic import BaseModel, Field, StrictStr, conint
-
-
-class RunningSandbox(BaseModel):
- """
- RunningSandbox
- """
-
- template_id: StrictStr = Field(
- ...,
- alias="templateID",
- description="Identifier of the template from which is the sandbox created",
- )
- alias: Optional[StrictStr] = Field(None, description="Alias of the template")
- sandbox_id: StrictStr = Field(
- ..., alias="sandboxID", description="Identifier of the sandbox"
- )
- client_id: StrictStr = Field(
- ..., alias="clientID", description="Identifier of the client"
- )
- started_at: datetime = Field(
- ..., alias="startedAt", description="Time when the sandbox was started"
- )
- cpu_count: conint(strict=True, le=8, ge=1) = Field(
- ..., alias="cpuCount", description="CPU cores for the sandbox"
- )
- memory_mb: conint(strict=True, le=8192, ge=128) = Field(
- ..., alias="memoryMB", description="Memory for the sandbox in MB"
- )
- metadata: Optional[Dict[str, StrictStr]] = None
- additional_properties: Dict[str, Any] = {}
- __properties = [
- "templateID",
- "alias",
- "sandboxID",
- "clientID",
- "startedAt",
- "cpuCount",
- "memoryMB",
- "metadata",
- ]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> RunningSandbox:
- """Create an instance of RunningSandbox from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> RunningSandbox:
- """Create an instance of RunningSandbox from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return RunningSandbox.parse_obj(obj)
-
- _obj = RunningSandbox.parse_obj(
- {
- "template_id": obj.get("templateID"),
- "alias": obj.get("alias"),
- "sandbox_id": obj.get("sandboxID"),
- "client_id": obj.get("clientID"),
- "started_at": obj.get("startedAt"),
- "cpu_count": obj.get("cpuCount"),
- "memory_mb": obj.get("memoryMB"),
- "metadata": obj.get("metadata"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/sandbox.py b/packages/python-sdk/e2b/api/v1/client/models/sandbox.py
deleted file mode 100644
index 3a3f45c6c..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/sandbox.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, Optional
-from pydantic import BaseModel, Field, StrictStr
-
-
-class Sandbox(BaseModel):
- """
- Sandbox
- """
-
- template_id: StrictStr = Field(
- ...,
- alias="templateID",
- description="Identifier of the template from which is the sandbox created",
- )
- sandbox_id: StrictStr = Field(
- ..., alias="sandboxID", description="Identifier of the sandbox"
- )
- alias: Optional[StrictStr] = Field(None, description="Alias of the template")
- client_id: StrictStr = Field(
- ..., alias="clientID", description="Identifier of the client"
- )
- envd_version: StrictStr = Field(
- ...,
- alias="envdVersion",
- description="Version of the envd running in the sandbox",
- )
- additional_properties: Dict[str, Any] = {}
- __properties = ["templateID", "sandboxID", "alias", "clientID", "envdVersion"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Sandbox:
- """Create an instance of Sandbox from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> Sandbox:
- """Create an instance of Sandbox from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return Sandbox.parse_obj(obj)
-
- _obj = Sandbox.parse_obj(
- {
- "template_id": obj.get("templateID"),
- "sandbox_id": obj.get("sandboxID"),
- "alias": obj.get("alias"),
- "client_id": obj.get("clientID"),
- "envd_version": obj.get("envdVersion"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/sandbox_log.py b/packages/python-sdk/e2b/api/v1/client/models/sandbox_log.py
deleted file mode 100644
index 081244529..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/sandbox_log.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-from datetime import datetime
-from typing import Any, Dict
-from pydantic import BaseModel, Field, StrictStr
-
-
-class SandboxLog(BaseModel):
- """
- Log entry with timestamp and line # noqa: E501
- """
-
- timestamp: datetime = Field(..., description="Timestamp of the log entry")
- line: StrictStr = Field(..., description="Log line content")
- additional_properties: Dict[str, Any] = {}
- __properties = ["timestamp", "line"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> SandboxLog:
- """Create an instance of SandboxLog from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> SandboxLog:
- """Create an instance of SandboxLog from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return SandboxLog.parse_obj(obj)
-
- _obj = SandboxLog.parse_obj(
- {"timestamp": obj.get("timestamp"), "line": obj.get("line")}
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/v1/client/models/sandbox_logs.py
deleted file mode 100644
index d593bb8e3..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/sandbox_logs.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, List
-from pydantic import BaseModel, Field, conlist
-from e2b.api.v1.client.models.sandbox_log import SandboxLog
-
-
-class SandboxLogs(BaseModel):
- """
- SandboxLogs
- """
-
- logs: conlist(SandboxLog) = Field(..., description="Logs of the sandbox")
- additional_properties: Dict[str, Any] = {}
- __properties = ["logs"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> SandboxLogs:
- """Create an instance of SandboxLogs from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # override the default output from pydantic by calling `to_dict()` of each item in logs (list)
- _items = []
- if self.logs:
- for _item in self.logs:
- if _item:
- _items.append(_item.to_dict())
- _dict["logs"] = _items
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> SandboxLogs:
- """Create an instance of SandboxLogs from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return SandboxLogs.parse_obj(obj)
-
- _obj = SandboxLogs.parse_obj(
- {
- "logs": [SandboxLog.from_dict(_item) for _item in obj.get("logs")]
- if obj.get("logs") is not None
- else None
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_refreshes_post_request.py b/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_refreshes_post_request.py
deleted file mode 100644
index ecbb657b1..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_refreshes_post_request.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, Optional
-from pydantic import BaseModel, Field, conint
-
-
-class SandboxesSandboxIDRefreshesPostRequest(BaseModel):
- """
- SandboxesSandboxIDRefreshesPostRequest
- """
-
- duration: Optional[conint(strict=True, le=3600, ge=0)] = Field(
- None,
- description="Duration for which the sandbox should be kept alive in seconds",
- )
- additional_properties: Dict[str, Any] = {}
- __properties = ["duration"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> SandboxesSandboxIDRefreshesPostRequest:
- """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> SandboxesSandboxIDRefreshesPostRequest:
- """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return SandboxesSandboxIDRefreshesPostRequest.parse_obj(obj)
-
- _obj = SandboxesSandboxIDRefreshesPostRequest.parse_obj(
- {"duration": obj.get("duration")}
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_timeout_post_request.py b/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_timeout_post_request.py
deleted file mode 100644
index def5117ba..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_timeout_post_request.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict
-from pydantic import BaseModel, Field, conint
-
-
-class SandboxesSandboxIDTimeoutPostRequest(BaseModel):
- """
- SandboxesSandboxIDTimeoutPostRequest
- """
-
- timeout: conint(strict=True, ge=0) = Field(
- ...,
- description="Timeout in seconds from the current time after which the sandbox should expire",
- )
- additional_properties: Dict[str, Any] = {}
- __properties = ["timeout"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> SandboxesSandboxIDTimeoutPostRequest:
- """Create an instance of SandboxesSandboxIDTimeoutPostRequest from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> SandboxesSandboxIDTimeoutPostRequest:
- """Create an instance of SandboxesSandboxIDTimeoutPostRequest from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return SandboxesSandboxIDTimeoutPostRequest.parse_obj(obj)
-
- _obj = SandboxesSandboxIDTimeoutPostRequest.parse_obj(
- {"timeout": obj.get("timeout")}
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/template.py b/packages/python-sdk/e2b/api/v1/client/models/template.py
deleted file mode 100644
index 6aec647a1..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/template.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, List, Optional
-from pydantic import BaseModel, Field, StrictBool, StrictStr, conint, conlist
-
-
-class Template(BaseModel):
- """
- Template
- """
-
- template_id: StrictStr = Field(
- ..., alias="templateID", description="Identifier of the template"
- )
- build_id: StrictStr = Field(
- ...,
- alias="buildID",
- description="Identifier of the last successful build for given template",
- )
- cpu_count: conint(strict=True, le=8, ge=1) = Field(
- ..., alias="cpuCount", description="CPU cores for the sandbox"
- )
- memory_mb: conint(strict=True, le=8192, ge=128) = Field(
- ..., alias="memoryMB", description="Memory for the sandbox in MB"
- )
- public: StrictBool = Field(
- ..., description="Whether the template is public or only accessible by the team"
- )
- aliases: Optional[conlist(StrictStr)] = Field(
- None, description="Aliases of the template"
- )
- additional_properties: Dict[str, Any] = {}
- __properties = [
- "templateID",
- "buildID",
- "cpuCount",
- "memoryMB",
- "public",
- "aliases",
- ]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Template:
- """Create an instance of Template from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> Template:
- """Create an instance of Template from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return Template.parse_obj(obj)
-
- _obj = Template.parse_obj(
- {
- "template_id": obj.get("templateID"),
- "build_id": obj.get("buildID"),
- "cpu_count": obj.get("cpuCount"),
- "memory_mb": obj.get("memoryMB"),
- "public": obj.get("public"),
- "aliases": obj.get("aliases"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/template_build.py b/packages/python-sdk/e2b/api/v1/client/models/template_build.py
deleted file mode 100644
index 1416d6b84..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/template_build.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, List
-from pydantic import BaseModel, Field, StrictStr, conlist, validator
-
-
-class TemplateBuild(BaseModel):
- """
- TemplateBuild
- """
-
- logs: conlist(StrictStr) = Field(..., description="Build logs")
- template_id: StrictStr = Field(
- ..., alias="templateID", description="Identifier of the template"
- )
- build_id: StrictStr = Field(
- ..., alias="buildID", description="Identifier of the build"
- )
- status: StrictStr = Field(..., description="Status of the template")
- additional_properties: Dict[str, Any] = {}
- __properties = ["logs", "templateID", "buildID", "status"]
-
- @validator("status")
- def status_validate_enum(cls, value):
- """Validates the enum"""
- if value not in ("building", "ready", "error"):
- raise ValueError(
- "must be one of enum values ('building', 'ready', 'error')"
- )
- return value
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> TemplateBuild:
- """Create an instance of TemplateBuild from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> TemplateBuild:
- """Create an instance of TemplateBuild from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return TemplateBuild.parse_obj(obj)
-
- _obj = TemplateBuild.parse_obj(
- {
- "logs": obj.get("logs"),
- "template_id": obj.get("templateID"),
- "build_id": obj.get("buildID"),
- "status": obj.get("status"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/models/template_build_request.py b/packages/python-sdk/e2b/api/v1/client/models/template_build_request.py
deleted file mode 100644
index b1d4b19ca..000000000
--- a/packages/python-sdk/e2b/api/v1/client/models/template_build_request.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, Dict, Optional
-from pydantic import BaseModel, Field, StrictStr, conint
-
-
-class TemplateBuildRequest(BaseModel):
- """
- TemplateBuildRequest
- """
-
- alias: Optional[StrictStr] = Field(None, description="Alias of the template")
- dockerfile: StrictStr = Field(..., description="Dockerfile for the template")
- start_cmd: Optional[StrictStr] = Field(
- None,
- alias="startCmd",
- description="Start command to execute in the template after the build",
- )
- cpu_count: Optional[conint(strict=True, le=8, ge=1)] = Field(
- None, alias="cpuCount", description="CPU cores for the sandbox"
- )
- memory_mb: Optional[conint(strict=True, le=8192, ge=128)] = Field(
- None, alias="memoryMB", description="Memory for the sandbox in MB"
- )
- additional_properties: Dict[str, Any] = {}
- __properties = ["alias", "dockerfile", "startCmd", "cpuCount", "memoryMB"]
-
- class Config:
- """Pydantic configuration"""
-
- allow_population_by_field_name = True
- validate_assignment = True
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.dict(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> TemplateBuildRequest:
- """Create an instance of TemplateBuildRequest from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self):
- """Returns the dictionary representation of the model using alias"""
- _dict = self.dict(
- by_alias=True, exclude={"additional_properties"}, exclude_none=True
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: dict) -> TemplateBuildRequest:
- """Create an instance of TemplateBuildRequest from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return TemplateBuildRequest.parse_obj(obj)
-
- _obj = TemplateBuildRequest.parse_obj(
- {
- "alias": obj.get("alias"),
- "dockerfile": obj.get("dockerfile"),
- "start_cmd": obj.get("startCmd"),
- "cpu_count": obj.get("cpuCount"),
- "memory_mb": obj.get("memoryMB"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v1/client/rest.py b/packages/python-sdk/e2b/api/v1/client/rest.py
deleted file mode 100644
index b7be37ee4..000000000
--- a/packages/python-sdk/e2b/api/v1/client/rest.py
+++ /dev/null
@@ -1,403 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import io
-import json
-import logging
-import re
-import ssl
-
-from urllib.parse import urlencode, quote_plus
-import urllib3
-
-from e2b.api.v1.client.exceptions import (
- ApiException,
- UnauthorizedException,
- ForbiddenException,
- NotFoundException,
- ServiceException,
- ApiValueError,
- BadRequestException,
-)
-
-
-logger = logging.getLogger(__name__)
-
-
-class RESTResponse(io.IOBase):
- def __init__(self, resp) -> None:
- self.urllib3_response = resp
- self.status = resp.status
- self.reason = resp.reason
- self.data = resp.data
-
- def getheaders(self):
- """Returns a dictionary of the response headers."""
- return self.urllib3_response.headers
-
- def getheader(self, name, default=None):
- """Returns a given response header."""
- return self.urllib3_response.headers.get(name, default)
-
-
-class RESTClientObject:
- def __init__(self, configuration, pools_size=4, maxsize=None) -> None:
- # urllib3.PoolManager will pass all kw parameters to connectionpool
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
- # maxsize is the number of requests to host that are allowed in parallel # noqa: E501
- # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
-
- # cert_reqs
- if configuration.verify_ssl:
- cert_reqs = ssl.CERT_REQUIRED
- else:
- cert_reqs = ssl.CERT_NONE
-
- addition_pool_args = {}
- if configuration.assert_hostname is not None:
- addition_pool_args[
- "assert_hostname"
- ] = configuration.assert_hostname # noqa: E501
-
- if configuration.retries is not None:
- addition_pool_args["retries"] = configuration.retries
-
- if configuration.tls_server_name:
- addition_pool_args["server_hostname"] = configuration.tls_server_name
-
- if configuration.socket_options is not None:
- addition_pool_args["socket_options"] = configuration.socket_options
-
- if maxsize is None:
- if configuration.connection_pool_maxsize is not None:
- maxsize = configuration.connection_pool_maxsize
- else:
- maxsize = 4
-
- # https pool manager
- if configuration.proxy:
- self.pool_manager = urllib3.ProxyManager(
- num_pools=pools_size,
- maxsize=maxsize,
- cert_reqs=cert_reqs,
- ca_certs=configuration.ssl_ca_cert,
- cert_file=configuration.cert_file,
- key_file=configuration.key_file,
- proxy_url=configuration.proxy,
- proxy_headers=configuration.proxy_headers,
- **addition_pool_args
- )
- else:
- self.pool_manager = urllib3.PoolManager(
- num_pools=pools_size,
- maxsize=maxsize,
- cert_reqs=cert_reqs,
- ca_certs=configuration.ssl_ca_cert,
- cert_file=configuration.cert_file,
- key_file=configuration.key_file,
- **addition_pool_args
- )
-
- def request(
- self,
- method,
- url,
- query_params=None,
- headers=None,
- body=None,
- post_params=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- """Perform requests.
-
- :param method: http request method
- :param url: http request url
- :param query_params: query parameters in the url
- :param headers: http request headers
- :param body: request json body, for `application/json`
- :param post_params: request post parameters,
- `application/x-www-form-urlencoded`
- and `multipart/form-data`
- :param _preload_content: if False, the urllib3.HTTPResponse object will
- be returned without reading/decoding response
- data. Default is True.
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- """
- method = method.upper()
- assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
-
- if post_params and body:
- raise ApiValueError(
- "body parameter cannot be used with post_params parameter."
- )
-
- post_params = post_params or {}
- headers = headers or {}
- # url already contains the URL query string
- # so reset query_params to empty dict
- query_params = {}
-
- timeout = None
- if _request_timeout:
- if isinstance(_request_timeout, (int, float)): # noqa: E501,F821
- timeout = urllib3.Timeout(total=_request_timeout)
- elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
- timeout = urllib3.Timeout(
- connect=_request_timeout[0], read=_request_timeout[1]
- )
-
- try:
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
- if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
- # no content type provided or payload is json
- if not headers.get("Content-Type") or re.search(
- "json", headers["Content-Type"], re.IGNORECASE
- ):
- request_body = None
- if body is not None:
- request_body = json.dumps(body)
- r = self.pool_manager.request(
- method,
- url,
- body=request_body,
- preload_content=_preload_content,
- timeout=timeout,
- headers=headers,
- )
- elif (
- headers["Content-Type"] == "application/x-www-form-urlencoded"
- ): # noqa: E501
- r = self.pool_manager.request(
- method,
- url,
- fields=post_params,
- encode_multipart=False,
- preload_content=_preload_content,
- timeout=timeout,
- headers=headers,
- )
- elif headers["Content-Type"] == "multipart/form-data":
- # must del headers['Content-Type'], or the correct
- # Content-Type which generated by urllib3 will be
- # overwritten.
- del headers["Content-Type"]
- r = self.pool_manager.request(
- method,
- url,
- fields=post_params,
- encode_multipart=True,
- preload_content=_preload_content,
- timeout=timeout,
- headers=headers,
- )
- # Pass a `string` parameter directly in the body to support
- # other content types than Json when `body` argument is
- # provided in serialized form
- elif isinstance(body, str) or isinstance(body, bytes):
- request_body = body
- r = self.pool_manager.request(
- method,
- url,
- body=request_body,
- preload_content=_preload_content,
- timeout=timeout,
- headers=headers,
- )
- else:
- # Cannot generate the request from given parameters
- msg = """Cannot prepare a request message for provided
- arguments. Please check that your arguments match
- declared content type."""
- raise ApiException(status=0, reason=msg)
- # For `GET`, `HEAD`
- else:
- r = self.pool_manager.request(
- method,
- url,
- fields={},
- preload_content=_preload_content,
- timeout=timeout,
- headers=headers,
- )
- except urllib3.exceptions.SSLError as e:
- msg = "{0}\n{1}".format(type(e).__name__, str(e))
- raise ApiException(status=0, reason=msg)
-
- if _preload_content:
- r = RESTResponse(r)
-
- # log response body
- logger.debug("response body: %s", r.data)
-
- if not 200 <= r.status <= 299:
- if r.status == 400:
- raise BadRequestException(http_resp=r)
-
- if r.status == 401:
- raise UnauthorizedException(http_resp=r)
-
- if r.status == 403:
- raise ForbiddenException(http_resp=r)
-
- if r.status == 404:
- raise NotFoundException(http_resp=r)
-
- if 500 <= r.status <= 599:
- raise ServiceException(http_resp=r)
-
- raise ApiException(http_resp=r)
-
- return r
-
- def get_request(
- self,
- url,
- headers=None,
- query_params=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "GET",
- url,
- headers=headers,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- query_params=query_params,
- )
-
- def head_request(
- self,
- url,
- headers=None,
- query_params=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "HEAD",
- url,
- headers=headers,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- query_params=query_params,
- )
-
- def options_request(
- self,
- url,
- headers=None,
- query_params=None,
- post_params=None,
- body=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "OPTIONS",
- url,
- headers=headers,
- query_params=query_params,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
-
- def delete_request(
- self,
- url,
- headers=None,
- query_params=None,
- body=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "DELETE",
- url,
- headers=headers,
- query_params=query_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
-
- def post_request(
- self,
- url,
- headers=None,
- query_params=None,
- post_params=None,
- body=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "POST",
- url,
- headers=headers,
- query_params=query_params,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
-
- def put_request(
- self,
- url,
- headers=None,
- query_params=None,
- post_params=None,
- body=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "PUT",
- url,
- headers=headers,
- query_params=query_params,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
-
- def patch_request(
- self,
- url,
- headers=None,
- query_params=None,
- post_params=None,
- body=None,
- _preload_content=True,
- _request_timeout=None,
- ):
- return self.request(
- "PATCH",
- url,
- headers=headers,
- query_params=query_params,
- post_params=post_params,
- _preload_content=_preload_content,
- _request_timeout=_request_timeout,
- body=body,
- )
diff --git a/packages/python-sdk/e2b/api/v1/client_README.md b/packages/python-sdk/e2b/api/v1/client_README.md
deleted file mode 100644
index db9465051..000000000
--- a/packages/python-sdk/e2b/api/v1/client_README.md
+++ /dev/null
@@ -1,120 +0,0 @@
-# e2b.api.v1.client
-No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
-The `e2b.api.v1.client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
-
-- API version: 0.1.0
-- Package version: 1.0.0
-- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen
-
-## Requirements.
-
-Python 3.7+
-
-## Installation & Usage
-
-This python library package is generated without supporting files like setup.py or requirements files
-
-To be able to use it, you will need these dependencies in your own package that uses this library:
-
-* urllib3 >= 1.25.3
-* python-dateutil
-* pydantic
-* aenum
-
-## Getting Started
-
-In your own code, to use this library to connect and interact with e2b.api.v1.client,
-you can run the following:
-
-```python
-
-import time
-import e2b.api.v1.client
-from e2b.api.v1.client.rest import ApiException
-from pprint import pprint
-
-# Defining the host is optional and defaults to https://api.e2b.dev
-# See configuration.py for a list of all supported configuration parameters.
-configuration = e2b.api.v1.client.Configuration(
- host = "https://api.e2b.dev"
-)
-
-# The client must configure the authentication and authorization parameters
-# in accordance with the API server security policy.
-# Examples for each auth method are provided below, use the example that
-# satisfies your auth use case.
-
-# Configure API key authorization: ApiKeyAuth
-configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
-
-# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
-# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'
-
-
-# Enter a context with an instance of the API client
-with e2b.api.v1.client.ApiClient(configuration) as api_client:
- # Create an instance of the API class
- api_instance = e2b.api.v1.client.SandboxesApi(api_client)
-
- try:
- api_response = api_instance.sandboxes_get()
- print("The response of SandboxesApi->sandboxes_get:\n")
- pprint(api_response)
- except ApiException as e:
- print("Exception when calling SandboxesApi->sandboxes_get: %s\n" % e)
-
-```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *https://api.e2b.dev*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-*SandboxesApi* | [**sandboxes_get**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_get) | **GET** /sandboxes |
-*SandboxesApi* | [**sandboxes_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_post) | **POST** /sandboxes |
-*SandboxesApi* | [**sandboxes_sandbox_id_delete**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_delete) | **DELETE** /sandboxes/{sandboxID} |
-*SandboxesApi* | [**sandboxes_sandbox_id_logs_get**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_logs_get) | **GET** /sandboxes/{sandboxID}/logs |
-*SandboxesApi* | [**sandboxes_sandbox_id_refreshes_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_refreshes_post) | **POST** /sandboxes/{sandboxID}/refreshes |
-*SandboxesApi* | [**sandboxes_sandbox_id_timeout_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_timeout_post) | **POST** /sandboxes/{sandboxID}/timeout |
-
-
-## Documentation For Models
-
- - [Error](e2b/api/v1/client/docs/Error.md)
- - [NewSandbox](e2b/api/v1/client/docs/NewSandbox.md)
- - [RunningSandbox](e2b/api/v1/client/docs/RunningSandbox.md)
- - [Sandbox](e2b/api/v1/client/docs/Sandbox.md)
- - [SandboxLog](e2b/api/v1/client/docs/SandboxLog.md)
- - [SandboxLogs](e2b/api/v1/client/docs/SandboxLogs.md)
- - [SandboxesSandboxIDRefreshesPostRequest](e2b/api/v1/client/docs/SandboxesSandboxIDRefreshesPostRequest.md)
- - [SandboxesSandboxIDTimeoutPostRequest](e2b/api/v1/client/docs/SandboxesSandboxIDTimeoutPostRequest.md)
- - [Template](e2b/api/v1/client/docs/Template.md)
- - [TemplateBuild](e2b/api/v1/client/docs/TemplateBuild.md)
- - [TemplateBuildRequest](e2b/api/v1/client/docs/TemplateBuildRequest.md)
-
-
-<a id="documentation-for-authorization"></a>
-## Documentation For Authorization
-
-
-Authentication schemes defined for the API:
-<a id="ApiKeyAuth"></a>
-### ApiKeyAuth
-
-- **Type**: API key
-- **API key parameter name**: X-API-Key
-- **Location**: HTTP header
-
-<a id="AccessTokenAuth"></a>
-### AccessTokenAuth
-
-- **Type**: Bearer authentication (access_token)
-
-
-## Author
-
-
-
-
diff --git a/packages/python-sdk/e2b/api/v2/client/__init__.py b/packages/python-sdk/e2b/api/v2/client/__init__.py
deleted file mode 100644
index 075fda49a..000000000
--- a/packages/python-sdk/e2b/api/v2/client/__init__.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-__version__ = "1.0.0"
-
-# import apis into sdk package
-from e2b.api.v2.client.api.sandboxes_api import SandboxesApi
-
-# import ApiClient
-from e2b.api.v2.client.api_response import ApiResponse
-from e2b.api.v2.client.api_client import ApiClient
-from e2b.api.v2.client.configuration import Configuration
-from e2b.api.v2.client.exceptions import OpenApiException
-from e2b.api.v2.client.exceptions import ApiTypeError
-from e2b.api.v2.client.exceptions import ApiValueError
-from e2b.api.v2.client.exceptions import ApiKeyError
-from e2b.api.v2.client.exceptions import ApiAttributeError
-from e2b.api.v2.client.exceptions import ApiException
-
-# import models into sdk package
-from e2b.api.v2.client.models.error import Error
-from e2b.api.v2.client.models.new_sandbox import NewSandbox
-from e2b.api.v2.client.models.running_sandbox import RunningSandbox
-from e2b.api.v2.client.models.sandbox import Sandbox
-from e2b.api.v2.client.models.sandbox_log import SandboxLog
-from e2b.api.v2.client.models.sandbox_logs import SandboxLogs
-from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (
- SandboxesSandboxIDRefreshesPostRequest,
-)
-from e2b.api.v2.client.models.sandboxes_sandbox_id_timeout_post_request import (
- SandboxesSandboxIDTimeoutPostRequest,
-)
-from e2b.api.v2.client.models.template import Template
-from e2b.api.v2.client.models.template_build import TemplateBuild
-from e2b.api.v2.client.models.template_build_request import TemplateBuildRequest
diff --git a/packages/python-sdk/e2b/api/v2/client/api/__init__.py b/packages/python-sdk/e2b/api/v2/client/api/__init__.py
deleted file mode 100644
index 821cd50f1..000000000
--- a/packages/python-sdk/e2b/api/v2/client/api/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# flake8: noqa
-
-# import apis into api package
-from e2b.api.v2.client.api.sandboxes_api import SandboxesApi
diff --git a/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py b/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py
deleted file mode 100644
index 60c913be9..000000000
--- a/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py
+++ /dev/null
@@ -1,1608 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import io
-import warnings
-
-from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
-from typing import Dict, List, Optional, Tuple, Union, Any
-
-try:
- from typing import Annotated
-except ImportError:
- from typing_extensions import Annotated
-
-from pydantic import Field
-from typing_extensions import Annotated
-from pydantic import StrictStr
-
-from typing import List, Optional
-
-from e2b.api.v2.client.models.new_sandbox import NewSandbox
-from e2b.api.v2.client.models.running_sandbox import RunningSandbox
-from e2b.api.v2.client.models.sandbox import Sandbox
-from e2b.api.v2.client.models.sandbox_logs import SandboxLogs
-from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (
- SandboxesSandboxIDRefreshesPostRequest,
-)
-from e2b.api.v2.client.models.sandboxes_sandbox_id_timeout_post_request import (
- SandboxesSandboxIDTimeoutPostRequest,
-)
-
-from e2b.api.v2.client.api_client import ApiClient
-from e2b.api.v2.client.api_response import ApiResponse
-from e2b.api.v2.client.rest import RESTResponseType
-
-
-class SandboxesApi:
- """NOTE: This class is auto generated by OpenAPI Generator
- Ref: https://openapi-generator.tech
-
- Do not edit the class manually.
- """
-
- def __init__(self, api_client=None) -> None:
- if api_client is None:
- api_client = ApiClient.get_default()
- self.api_client = api_client
-
- @validate_call
- def sandboxes_get(
- self,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> List[RunningSandbox]:
- """sandboxes_get
-
- List all running sandboxes
-
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_get_serialize(
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "200": "List[RunningSandbox]",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- ).data
-
- @validate_call
- def sandboxes_get_with_http_info(
- self,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> ApiResponse[List[RunningSandbox]]:
- """sandboxes_get
-
- List all running sandboxes
-
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_get_serialize(
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "200": "List[RunningSandbox]",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- )
-
- @validate_call
- def sandboxes_get_without_preload_content(
- self,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> RESTResponseType:
- """sandboxes_get
-
- List all running sandboxes
-
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_get_serialize(
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "200": "List[RunningSandbox]",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- return response_data.response
-
- def _sandboxes_get_serialize(
- self,
- _request_auth,
- _content_type,
- _headers,
- _host_index,
- ) -> Tuple:
- _host = None
-
- _collection_formats: Dict[str, str] = {}
-
- _path_params: Dict[str, str] = {}
- _query_params: List[Tuple[str, str]] = []
- _header_params: Dict[str, Optional[str]] = _headers or {}
- _form_params: List[Tuple[str, str]] = []
- _files: Dict[str, str] = {}
- _body_params: Optional[bytes] = None
-
- # process the path parameters
- # process the query parameters
- # process the header parameters
- # process the form parameters
- # process the body parameter
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- )
-
- # authentication setting
- _auth_settings: List[str] = ["ApiKeyAuth"]
-
- return self.api_client.param_serialize(
- method="GET",
- resource_path="/sandboxes",
- path_params=_path_params,
- query_params=_query_params,
- header_params=_header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- auth_settings=_auth_settings,
- collection_formats=_collection_formats,
- _host=_host,
- _request_auth=_request_auth,
- )
-
- @validate_call
- def sandboxes_post(
- self,
- new_sandbox: NewSandbox,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> Sandbox:
- """sandboxes_post
-
- Create a sandbox from the template
-
- :param new_sandbox: (required)
- :type new_sandbox: NewSandbox
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_post_serialize(
- new_sandbox=new_sandbox,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "201": "Sandbox",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- ).data
-
- @validate_call
- def sandboxes_post_with_http_info(
- self,
- new_sandbox: NewSandbox,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> ApiResponse[Sandbox]:
- """sandboxes_post
-
- Create a sandbox from the template
-
- :param new_sandbox: (required)
- :type new_sandbox: NewSandbox
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_post_serialize(
- new_sandbox=new_sandbox,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "201": "Sandbox",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- )
-
- @validate_call
- def sandboxes_post_without_preload_content(
- self,
- new_sandbox: NewSandbox,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> RESTResponseType:
- """sandboxes_post
-
- Create a sandbox from the template
-
- :param new_sandbox: (required)
- :type new_sandbox: NewSandbox
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_post_serialize(
- new_sandbox=new_sandbox,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "201": "Sandbox",
- "401": "Error",
- "400": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- return response_data.response
-
- def _sandboxes_post_serialize(
- self,
- new_sandbox,
- _request_auth,
- _content_type,
- _headers,
- _host_index,
- ) -> Tuple:
- _host = None
-
- _collection_formats: Dict[str, str] = {}
-
- _path_params: Dict[str, str] = {}
- _query_params: List[Tuple[str, str]] = []
- _header_params: Dict[str, Optional[str]] = _headers or {}
- _form_params: List[Tuple[str, str]] = []
- _files: Dict[str, str] = {}
- _body_params: Optional[bytes] = None
-
- # process the path parameters
- # process the query parameters
- # process the header parameters
- # process the form parameters
- # process the body parameter
- if new_sandbox is not None:
- _body_params = new_sandbox
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- )
-
- # set the HTTP header `Content-Type`
- if _content_type:
- _header_params["Content-Type"] = _content_type
- else:
- _default_content_type = self.api_client.select_header_content_type(
- ["application/json"]
- )
- if _default_content_type is not None:
- _header_params["Content-Type"] = _default_content_type
-
- # authentication setting
- _auth_settings: List[str] = ["ApiKeyAuth"]
-
- return self.api_client.param_serialize(
- method="POST",
- resource_path="/sandboxes",
- path_params=_path_params,
- query_params=_query_params,
- header_params=_header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- auth_settings=_auth_settings,
- collection_formats=_collection_formats,
- _host=_host,
- _request_auth=_request_auth,
- )
-
- @validate_call
- def sandboxes_sandbox_id_delete(
- self,
- sandbox_id: StrictStr,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> None:
- """sandboxes_sandbox_id_delete
-
- Kill a sandbox
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_delete_serialize(
- sandbox_id=sandbox_id,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- ).data
-
- @validate_call
- def sandboxes_sandbox_id_delete_with_http_info(
- self,
- sandbox_id: StrictStr,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> ApiResponse[None]:
- """sandboxes_sandbox_id_delete
-
- Kill a sandbox
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_delete_serialize(
- sandbox_id=sandbox_id,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- )
-
- @validate_call
- def sandboxes_sandbox_id_delete_without_preload_content(
- self,
- sandbox_id: StrictStr,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> RESTResponseType:
- """sandboxes_sandbox_id_delete
-
- Kill a sandbox
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_delete_serialize(
- sandbox_id=sandbox_id,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- return response_data.response
-
- def _sandboxes_sandbox_id_delete_serialize(
- self,
- sandbox_id,
- _request_auth,
- _content_type,
- _headers,
- _host_index,
- ) -> Tuple:
- _host = None
-
- _collection_formats: Dict[str, str] = {}
-
- _path_params: Dict[str, str] = {}
- _query_params: List[Tuple[str, str]] = []
- _header_params: Dict[str, Optional[str]] = _headers or {}
- _form_params: List[Tuple[str, str]] = []
- _files: Dict[str, str] = {}
- _body_params: Optional[bytes] = None
-
- # process the path parameters
- if sandbox_id is not None:
- _path_params["sandboxID"] = sandbox_id
- # process the query parameters
- # process the header parameters
- # process the form parameters
- # process the body parameter
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- )
-
- # authentication setting
- _auth_settings: List[str] = ["ApiKeyAuth"]
-
- return self.api_client.param_serialize(
- method="DELETE",
- resource_path="/sandboxes/{sandboxID}",
- path_params=_path_params,
- query_params=_query_params,
- header_params=_header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- auth_settings=_auth_settings,
- collection_formats=_collection_formats,
- _host=_host,
- _request_auth=_request_auth,
- )
-
- @validate_call
- def sandboxes_sandbox_id_logs_get(
- self,
- sandbox_id: StrictStr,
- start: Annotated[
- Optional[Annotated[int, Field(strict=True, ge=0)]],
- Field(
- description="Starting timestamp of the logs that should be returned in milliseconds"
- ),
- ] = None,
- limit: Annotated[
- Optional[Annotated[int, Field(strict=True, ge=0)]],
- Field(description="Maximum number of logs that should be returned"),
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> SandboxLogs:
- """sandboxes_sandbox_id_logs_get
-
- Get sandbox logs
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param start: Starting timestamp of the logs that should be returned in milliseconds
- :type start: int
- :param limit: Maximum number of logs that should be returned
- :type limit: int
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_logs_get_serialize(
- sandbox_id=sandbox_id,
- start=start,
- limit=limit,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "200": "SandboxLogs",
- "404": "Error",
- "401": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- ).data
-
- @validate_call
- def sandboxes_sandbox_id_logs_get_with_http_info(
- self,
- sandbox_id: StrictStr,
- start: Annotated[
- Optional[Annotated[int, Field(strict=True, ge=0)]],
- Field(
- description="Starting timestamp of the logs that should be returned in milliseconds"
- ),
- ] = None,
- limit: Annotated[
- Optional[Annotated[int, Field(strict=True, ge=0)]],
- Field(description="Maximum number of logs that should be returned"),
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> ApiResponse[SandboxLogs]:
- """sandboxes_sandbox_id_logs_get
-
- Get sandbox logs
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param start: Starting timestamp of the logs that should be returned in milliseconds
- :type start: int
- :param limit: Maximum number of logs that should be returned
- :type limit: int
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_logs_get_serialize(
- sandbox_id=sandbox_id,
- start=start,
- limit=limit,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "200": "SandboxLogs",
- "404": "Error",
- "401": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- )
-
- @validate_call
- def sandboxes_sandbox_id_logs_get_without_preload_content(
- self,
- sandbox_id: StrictStr,
- start: Annotated[
- Optional[Annotated[int, Field(strict=True, ge=0)]],
- Field(
- description="Starting timestamp of the logs that should be returned in milliseconds"
- ),
- ] = None,
- limit: Annotated[
- Optional[Annotated[int, Field(strict=True, ge=0)]],
- Field(description="Maximum number of logs that should be returned"),
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> RESTResponseType:
- """sandboxes_sandbox_id_logs_get
-
- Get sandbox logs
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param start: Starting timestamp of the logs that should be returned in milliseconds
- :type start: int
- :param limit: Maximum number of logs that should be returned
- :type limit: int
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_logs_get_serialize(
- sandbox_id=sandbox_id,
- start=start,
- limit=limit,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {
- "200": "SandboxLogs",
- "404": "Error",
- "401": "Error",
- "500": "Error",
- }
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- return response_data.response
-
- def _sandboxes_sandbox_id_logs_get_serialize(
- self,
- sandbox_id,
- start,
- limit,
- _request_auth,
- _content_type,
- _headers,
- _host_index,
- ) -> Tuple:
- _host = None
-
- _collection_formats: Dict[str, str] = {}
-
- _path_params: Dict[str, str] = {}
- _query_params: List[Tuple[str, str]] = []
- _header_params: Dict[str, Optional[str]] = _headers or {}
- _form_params: List[Tuple[str, str]] = []
- _files: Dict[str, str] = {}
- _body_params: Optional[bytes] = None
-
- # process the path parameters
- if sandbox_id is not None:
- _path_params["sandboxID"] = sandbox_id
- # process the query parameters
- if start is not None:
- _query_params.append(("start", start))
-
- if limit is not None:
- _query_params.append(("limit", limit))
-
- # process the header parameters
- # process the form parameters
- # process the body parameter
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- )
-
- # authentication setting
- _auth_settings: List[str] = ["ApiKeyAuth"]
-
- return self.api_client.param_serialize(
- method="GET",
- resource_path="/sandboxes/{sandboxID}/logs",
- path_params=_path_params,
- query_params=_query_params,
- header_params=_header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- auth_settings=_auth_settings,
- collection_formats=_collection_formats,
- _host=_host,
- _request_auth=_request_auth,
- )
-
- @validate_call
- def sandboxes_sandbox_id_refreshes_post(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_refreshes_post_request: Optional[
- SandboxesSandboxIDRefreshesPostRequest
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> None:
- """sandboxes_sandbox_id_refreshes_post
-
- Refresh the sandbox extending its time to live
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_refreshes_post_request:
- :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_refreshes_post_serialize(
- sandbox_id=sandbox_id,
- sandboxes_sandbox_id_refreshes_post_request=sandboxes_sandbox_id_refreshes_post_request,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- ).data
-
- @validate_call
- def sandboxes_sandbox_id_refreshes_post_with_http_info(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_refreshes_post_request: Optional[
- SandboxesSandboxIDRefreshesPostRequest
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> ApiResponse[None]:
- """sandboxes_sandbox_id_refreshes_post
-
- Refresh the sandbox extending its time to live
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_refreshes_post_request:
- :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_refreshes_post_serialize(
- sandbox_id=sandbox_id,
- sandboxes_sandbox_id_refreshes_post_request=sandboxes_sandbox_id_refreshes_post_request,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- )
-
- @validate_call
- def sandboxes_sandbox_id_refreshes_post_without_preload_content(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_refreshes_post_request: Optional[
- SandboxesSandboxIDRefreshesPostRequest
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> RESTResponseType:
- """sandboxes_sandbox_id_refreshes_post
-
- Refresh the sandbox extending its time to live
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_refreshes_post_request:
- :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_refreshes_post_serialize(
- sandbox_id=sandbox_id,
- sandboxes_sandbox_id_refreshes_post_request=sandboxes_sandbox_id_refreshes_post_request,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- return response_data.response
-
- def _sandboxes_sandbox_id_refreshes_post_serialize(
- self,
- sandbox_id,
- sandboxes_sandbox_id_refreshes_post_request,
- _request_auth,
- _content_type,
- _headers,
- _host_index,
- ) -> Tuple:
- _host = None
-
- _collection_formats: Dict[str, str] = {}
-
- _path_params: Dict[str, str] = {}
- _query_params: List[Tuple[str, str]] = []
- _header_params: Dict[str, Optional[str]] = _headers or {}
- _form_params: List[Tuple[str, str]] = []
- _files: Dict[str, str] = {}
- _body_params: Optional[bytes] = None
-
- # process the path parameters
- if sandbox_id is not None:
- _path_params["sandboxID"] = sandbox_id
- # process the query parameters
- # process the header parameters
- # process the form parameters
- # process the body parameter
- if sandboxes_sandbox_id_refreshes_post_request is not None:
- _body_params = sandboxes_sandbox_id_refreshes_post_request
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- )
-
- # set the HTTP header `Content-Type`
- if _content_type:
- _header_params["Content-Type"] = _content_type
- else:
- _default_content_type = self.api_client.select_header_content_type(
- ["application/json"]
- )
- if _default_content_type is not None:
- _header_params["Content-Type"] = _default_content_type
-
- # authentication setting
- _auth_settings: List[str] = ["ApiKeyAuth"]
-
- return self.api_client.param_serialize(
- method="POST",
- resource_path="/sandboxes/{sandboxID}/refreshes",
- path_params=_path_params,
- query_params=_query_params,
- header_params=_header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- auth_settings=_auth_settings,
- collection_formats=_collection_formats,
- _host=_host,
- _request_auth=_request_auth,
- )
-
- @validate_call
- def sandboxes_sandbox_id_timeout_post(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_timeout_post_request: Optional[
- SandboxesSandboxIDTimeoutPostRequest
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> None:
- """sandboxes_sandbox_id_timeout_post
-
- Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration.
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_timeout_post_request:
- :type sandboxes_sandbox_id_timeout_post_request: SandboxesSandboxIDTimeoutPostRequest
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_timeout_post_serialize(
- sandbox_id=sandbox_id,
- sandboxes_sandbox_id_timeout_post_request=sandboxes_sandbox_id_timeout_post_request,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- ).data
-
- @validate_call
- def sandboxes_sandbox_id_timeout_post_with_http_info(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_timeout_post_request: Optional[
- SandboxesSandboxIDTimeoutPostRequest
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> ApiResponse[None]:
- """sandboxes_sandbox_id_timeout_post
-
- Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration.
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_timeout_post_request:
- :type sandboxes_sandbox_id_timeout_post_request: SandboxesSandboxIDTimeoutPostRequest
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_timeout_post_serialize(
- sandbox_id=sandbox_id,
- sandboxes_sandbox_id_timeout_post_request=sandboxes_sandbox_id_timeout_post_request,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- response_data.read()
- return self.api_client.response_deserialize(
- response_data=response_data,
- response_types_map=_response_types_map,
- )
-
- @validate_call
- def sandboxes_sandbox_id_timeout_post_without_preload_content(
- self,
- sandbox_id: StrictStr,
- sandboxes_sandbox_id_timeout_post_request: Optional[
- SandboxesSandboxIDTimeoutPostRequest
- ] = None,
- _request_timeout: Union[
- None,
- Annotated[StrictFloat, Field(gt=0)],
- Tuple[
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
- ],
- ] = None,
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
- _content_type: Optional[StrictStr] = None,
- _headers: Optional[Dict[StrictStr, Any]] = None,
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
- ) -> RESTResponseType:
- """sandboxes_sandbox_id_timeout_post
-
- Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration.
-
- :param sandbox_id: (required)
- :type sandbox_id: str
- :param sandboxes_sandbox_id_timeout_post_request:
- :type sandboxes_sandbox_id_timeout_post_request: SandboxesSandboxIDTimeoutPostRequest
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- :type _request_timeout: int, tuple(int, int), optional
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the
- authentication in the spec for a single request.
- :type _request_auth: dict, optional
- :param _content_type: force content-type for the request.
- :type _content_type: str, Optional
- :param _headers: set to override the headers for a single
- request; this effectively ignores the headers
- in the spec for a single request.
- :type _headers: dict, optional
- :param _host_index: set to override the host_index for a single
- request; this effectively ignores the host_index
- in the spec for a single request.
- :type _host_index: int, optional
- :return: Returns the result object.
- """ # noqa: E501
-
- _param = self._sandboxes_sandbox_id_timeout_post_serialize(
- sandbox_id=sandbox_id,
- sandboxes_sandbox_id_timeout_post_request=sandboxes_sandbox_id_timeout_post_request,
- _request_auth=_request_auth,
- _content_type=_content_type,
- _headers=_headers,
- _host_index=_host_index,
- )
-
- _response_types_map: Dict[str, Optional[str]] = {}
- response_data = self.api_client.call_api(
- *_param, _request_timeout=_request_timeout
- )
- return response_data.response
-
- def _sandboxes_sandbox_id_timeout_post_serialize(
- self,
- sandbox_id,
- sandboxes_sandbox_id_timeout_post_request,
- _request_auth,
- _content_type,
- _headers,
- _host_index,
- ) -> Tuple:
- _host = None
-
- _collection_formats: Dict[str, str] = {}
-
- _path_params: Dict[str, str] = {}
- _query_params: List[Tuple[str, str]] = []
- _header_params: Dict[str, Optional[str]] = _headers or {}
- _form_params: List[Tuple[str, str]] = []
- _files: Dict[str, str] = {}
- _body_params: Optional[bytes] = None
-
- # process the path parameters
- if sandbox_id is not None:
- _path_params["sandboxID"] = sandbox_id
- # process the query parameters
- # process the header parameters
- # process the form parameters
- # process the body parameter
- if sandboxes_sandbox_id_timeout_post_request is not None:
- _body_params = sandboxes_sandbox_id_timeout_post_request
-
- # set the HTTP header `Accept`
- _header_params["Accept"] = self.api_client.select_header_accept(
- ["application/json"]
- )
-
- # set the HTTP header `Content-Type`
- if _content_type:
- _header_params["Content-Type"] = _content_type
- else:
- _default_content_type = self.api_client.select_header_content_type(
- ["application/json"]
- )
- if _default_content_type is not None:
- _header_params["Content-Type"] = _default_content_type
-
- # authentication setting
- _auth_settings: List[str] = ["ApiKeyAuth"]
-
- return self.api_client.param_serialize(
- method="POST",
- resource_path="/sandboxes/{sandboxID}/timeout",
- path_params=_path_params,
- query_params=_query_params,
- header_params=_header_params,
- body=_body_params,
- post_params=_form_params,
- files=_files,
- auth_settings=_auth_settings,
- collection_formats=_collection_formats,
- _host=_host,
- _request_auth=_request_auth,
- )
diff --git a/packages/python-sdk/e2b/api/v2/client/api_client.py b/packages/python-sdk/e2b/api/v2/client/api_client.py
deleted file mode 100644
index a25550038..000000000
--- a/packages/python-sdk/e2b/api/v2/client/api_client.py
+++ /dev/null
@@ -1,697 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import atexit
-import datetime
-from dateutil.parser import parse
-import json
-import mimetypes
-import os
-import re
-import tempfile
-
-from urllib.parse import quote
-from typing import Tuple, Optional, List
-
-from e2b.api.v2.client.configuration import Configuration
-from e2b.api.v2.client.api_response import ApiResponse
-import e2b.api.v2.client.models
-from e2b.api.v2.client import rest
-from e2b.api.v2.client.exceptions import (
- ApiValueError,
- ApiException,
- BadRequestException,
- UnauthorizedException,
- ForbiddenException,
- NotFoundException,
- ServiceException,
-)
-
-
-class ApiClient:
- """Generic API client for OpenAPI client library builds.
-
- OpenAPI generic API client. This client handles the client-
- server communication, and is invariant across implementations. Specifics of
- the methods and models for each application are generated from the OpenAPI
- templates.
-
- :param configuration: .Configuration object for this client
- :param header_name: a header to pass when making calls to the API.
- :param header_value: a header value to pass when making calls to
- the API.
- :param cookie: a cookie to include in the header when making calls
- to the API
- """
-
- PRIMITIVE_TYPES = (float, bool, bytes, str, int)
- NATIVE_TYPES_MAPPING = {
- "int": int,
- "long": int, # TODO remove as only py3 is supported?
- "float": float,
- "str": str,
- "bool": bool,
- "date": datetime.date,
- "datetime": datetime.datetime,
- "object": object,
- }
- _pool = None
-
- def __init__(
- self, configuration=None, header_name=None, header_value=None, cookie=None
- ) -> None:
- # use default configuration if none is provided
- if configuration is None:
- configuration = Configuration.get_default()
- self.configuration = configuration
-
- self.rest_client = rest.RESTClientObject(configuration)
- self.default_headers = {}
- if header_name is not None:
- self.default_headers[header_name] = header_value
- self.cookie = cookie
- # Set default User-Agent.
- self.user_agent = "OpenAPI-Generator/1.0.0/python"
- self.client_side_validation = configuration.client_side_validation
-
- def __enter__(self):
- return self
-
- def __exit__(self, exc_type, exc_value, traceback):
- pass
-
- @property
- def user_agent(self):
- """User agent for this API client"""
- return self.default_headers["User-Agent"]
-
- @user_agent.setter
- def user_agent(self, value):
- self.default_headers["User-Agent"] = value
-
- def set_default_header(self, header_name, header_value):
- self.default_headers[header_name] = header_value
-
- _default = None
-
- @classmethod
- def get_default(cls):
- """Return new instance of ApiClient.
-
- This method returns newly created, based on default constructor,
- object of ApiClient class or returns a copy of default
- ApiClient.
-
- :return: The ApiClient object.
- """
- if cls._default is None:
- cls._default = ApiClient()
- return cls._default
-
- @classmethod
- def set_default(cls, default):
- """Set default instance of ApiClient.
-
- It stores default ApiClient.
-
- :param default: object of ApiClient.
- """
- cls._default = default
-
- def param_serialize(
- self,
- method,
- resource_path,
- path_params=None,
- query_params=None,
- header_params=None,
- body=None,
- post_params=None,
- files=None,
- auth_settings=None,
- collection_formats=None,
- _host=None,
- _request_auth=None,
- ) -> Tuple:
- """Builds the HTTP request params needed by the request.
- :param method: Method to call.
- :param resource_path: Path to method endpoint.
- :param path_params: Path parameters in the url.
- :param query_params: Query parameters in the url.
- :param header_params: Header parameters to be
- placed in the request header.
- :param body: Request body.
- :param post_params dict: Request post form parameters,
- for `application/x-www-form-urlencoded`, `multipart/form-data`.
- :param auth_settings list: Auth Settings names for the request.
- :param files dict: key -> filename, value -> filepath,
- for `multipart/form-data`.
- :param collection_formats: dict of collection formats for path, query,
- header, and post parameters.
- :param _request_auth: set to override the auth_settings for an a single
- request; this effectively ignores the authentication
- in the spec for a single request.
- :return: tuple of form (path, http_method, query_params, header_params,
- body, post_params, files)
- """
-
- config = self.configuration
-
- # header parameters
- header_params = header_params or {}
- header_params.update(self.default_headers)
- if self.cookie:
- header_params["Cookie"] = self.cookie
- if header_params:
- header_params = self.sanitize_for_serialization(header_params)
- header_params = dict(
- self.parameters_to_tuples(header_params, collection_formats)
- )
-
- # path parameters
- if path_params:
- path_params = self.sanitize_for_serialization(path_params)
- path_params = self.parameters_to_tuples(path_params, collection_formats)
- for k, v in path_params:
- # specified safe chars, encode everything
- resource_path = resource_path.replace(
- "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)
- )
-
- # post parameters
- if post_params or files:
- post_params = post_params if post_params else []
- post_params = self.sanitize_for_serialization(post_params)
- post_params = self.parameters_to_tuples(post_params, collection_formats)
- post_params.extend(self.files_parameters(files))
-
- # auth setting
- self.update_params_for_auth(
- header_params,
- query_params,
- auth_settings,
- resource_path,
- method,
- body,
- request_auth=_request_auth,
- )
-
- # body
- if body:
- body = self.sanitize_for_serialization(body)
-
- # request url
- if _host is None:
- url = self.configuration.host + resource_path
- else:
- # use server/host defined in path or operation instead
- url = _host + resource_path
-
- # query parameters
- if query_params:
- query_params = self.sanitize_for_serialization(query_params)
- url_query = self.parameters_to_url_query(query_params, collection_formats)
- url += "?" + url_query
-
- return method, url, header_params, body, post_params
-
- def call_api(
- self,
- method,
- url,
- header_params=None,
- body=None,
- post_params=None,
- _request_timeout=None,
- ) -> rest.RESTResponse:
- """Makes the HTTP request (synchronous)
- :param method: Method to call.
- :param url: Path to method endpoint.
- :param header_params: Header parameters to be
- placed in the request header.
- :param body: Request body.
- :param post_params dict: Request post form parameters,
- for `application/x-www-form-urlencoded`, `multipart/form-data`.
- :param _request_timeout: timeout setting for this request.
- :return: RESTResponse
- """
-
- try:
- # perform request and return response
- response_data = self.rest_client.request(
- method,
- url,
- headers=header_params,
- body=body,
- post_params=post_params,
- _request_timeout=_request_timeout,
- )
-
- except ApiException as e:
- if e.body:
- e.body = e.body.decode("utf-8")
- raise e
-
- return response_data
-
- def response_deserialize(
- self, response_data=None, response_types_map=None
- ) -> ApiResponse:
- """Deserializes response into an object.
- :param response_data: RESTResponse object to be deserialized.
- :param response_types_map: dict of response types.
- :return: ApiResponse
- """
-
- response_type = response_types_map.get(str(response_data.status), None)
- if (
- not response_type
- and isinstance(response_data.status, int)
- and 100 <= response_data.status <= 599
- ):
- # if not found, look for '1XX', '2XX', etc.
- response_type = response_types_map.get(
- str(response_data.status)[0] + "XX", None
- )
-
- if not 200 <= response_data.status <= 299:
- if response_data.status == 400:
- raise BadRequestException(http_resp=response_data)
-
- if response_data.status == 401:
- raise UnauthorizedException(http_resp=response_data)
-
- if response_data.status == 403:
- raise ForbiddenException(http_resp=response_data)
-
- if response_data.status == 404:
- raise NotFoundException(http_resp=response_data)
-
- if 500 <= response_data.status <= 599:
- raise ServiceException(http_resp=response_data)
- raise ApiException(http_resp=response_data)
-
- # deserialize response data
-
- if response_type == "bytearray":
- return_data = response_data.data
- elif response_type is None:
- return_data = None
- elif response_type == "file":
- return_data = self.__deserialize_file(response_data)
- else:
- match = None
- content_type = response_data.getheader("content-type")
- if content_type is not None:
- match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
- encoding = match.group(1) if match else "utf-8"
- response_text = response_data.data.decode(encoding)
- return_data = self.deserialize(response_text, response_type)
-
- return ApiResponse(
- status_code=response_data.status,
- data=return_data,
- headers=response_data.getheaders(),
- raw_data=response_data.data,
- )
-
- def sanitize_for_serialization(self, obj):
- """Builds a JSON POST object.
-
- If obj is None, return None.
- If obj is str, int, long, float, bool, return directly.
- If obj is datetime.datetime, datetime.date
- convert to string in iso8601 format.
- If obj is list, sanitize each element in the list.
- If obj is dict, return the dict.
- If obj is OpenAPI model, return the properties dict.
-
- :param obj: The data to serialize.
- :return: The serialized form of data.
- """
- if obj is None:
- return None
- elif isinstance(obj, self.PRIMITIVE_TYPES):
- return obj
- elif isinstance(obj, list):
- return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
- elif isinstance(obj, tuple):
- return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
- elif isinstance(obj, (datetime.datetime, datetime.date)):
- return obj.isoformat()
-
- elif isinstance(obj, dict):
- obj_dict = obj
- else:
- # Convert model obj to dict except
- # attributes `openapi_types`, `attribute_map`
- # and attributes which value is not None.
- # Convert attribute name to json key in
- # model definition for request.
- obj_dict = obj.to_dict()
-
- return {
- key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()
- }
-
- def deserialize(self, response_text, response_type):
- """Deserializes response into an object.
-
- :param response: RESTResponse object to be deserialized.
- :param response_type: class literal for
- deserialized object, or string of class name.
-
- :return: deserialized object.
- """
-
- # fetch data from response object
- try:
- data = json.loads(response_text)
- except ValueError:
- data = response_text
-
- return self.__deserialize(data, response_type)
-
- def __deserialize(self, data, klass):
- """Deserializes dict, list, str into an object.
-
- :param data: dict, list or str.
- :param klass: class literal, or string of class name.
-
- :return: object.
- """
- if data is None:
- return None
-
- if isinstance(klass, str):
- if klass.startswith("List["):
- sub_kls = re.match(r"List\[(.*)]", klass).group(1)
- return [self.__deserialize(sub_data, sub_kls) for sub_data in data]
-
- if klass.startswith("Dict["):
- sub_kls = re.match(r"Dict\[([^,]*), (.*)]", klass).group(2)
- return {k: self.__deserialize(v, sub_kls) for k, v in data.items()}
-
- # convert str to class
- if klass in self.NATIVE_TYPES_MAPPING:
- klass = self.NATIVE_TYPES_MAPPING[klass]
- else:
- klass = getattr(e2b.api.v2.client.models, klass)
-
- if klass in self.PRIMITIVE_TYPES:
- return self.__deserialize_primitive(data, klass)
- elif klass == object:
- return self.__deserialize_object(data)
- elif klass == datetime.date:
- return self.__deserialize_date(data)
- elif klass == datetime.datetime:
- return self.__deserialize_datetime(data)
- else:
- return self.__deserialize_model(data, klass)
-
- def parameters_to_tuples(self, params, collection_formats):
- """Get parameters as list of tuples, formatting collections.
-
- :param params: Parameters as dict or list of two-tuples
- :param dict collection_formats: Parameter collection formats
- :return: Parameters as list of tuples, collections formatted
- """
- new_params = []
- if collection_formats is None:
- collection_formats = {}
- for k, v in params.items() if isinstance(params, dict) else params:
- if k in collection_formats:
- collection_format = collection_formats[k]
- if collection_format == "multi":
- new_params.extend((k, value) for value in v)
- else:
- if collection_format == "ssv":
- delimiter = " "
- elif collection_format == "tsv":
- delimiter = "\t"
- elif collection_format == "pipes":
- delimiter = "|"
- else: # csv is the default
- delimiter = ","
- new_params.append((k, delimiter.join(str(value) for value in v)))
- else:
- new_params.append((k, v))
- return new_params
-
- def parameters_to_url_query(self, params, collection_formats):
- """Get parameters as list of tuples, formatting collections.
-
- :param params: Parameters as dict or list of two-tuples
- :param dict collection_formats: Parameter collection formats
- :return: URL query string (e.g. a=Hello%20World&b=123)
- """
- new_params = []
- if collection_formats is None:
- collection_formats = {}
- for k, v in params.items() if isinstance(params, dict) else params:
- if isinstance(v, bool):
- v = str(v).lower()
- if isinstance(v, (int, float)):
- v = str(v)
- if isinstance(v, dict):
- v = json.dumps(v)
-
- if k in collection_formats:
- collection_format = collection_formats[k]
- if collection_format == "multi":
- new_params.extend((k, value) for value in v)
- else:
- if collection_format == "ssv":
- delimiter = " "
- elif collection_format == "tsv":
- delimiter = "\t"
- elif collection_format == "pipes":
- delimiter = "|"
- else: # csv is the default
- delimiter = ","
- new_params.append(
- (k, delimiter.join(quote(str(value)) for value in v))
- )
- else:
- new_params.append((k, quote(str(v))))
-
- return "&".join(["=".join(item) for item in new_params])
-
- def files_parameters(self, files=None):
- """Builds form parameters.
-
- :param files: File parameters.
- :return: Form parameters with files.
- """
- params = []
-
- if files:
- for k, v in files.items():
- if not v:
- continue
- file_names = v if type(v) is list else [v]
- for n in file_names:
- with open(n, "rb") as f:
- filename = os.path.basename(f.name)
- filedata = f.read()
- mimetype = (
- mimetypes.guess_type(filename)[0]
- or "application/octet-stream"
- )
- params.append(tuple([k, tuple([filename, filedata, mimetype])]))
-
- return params
-
- def select_header_accept(self, accepts: List[str]) -> Optional[str]:
- """Returns `Accept` based on an array of accepts provided.
-
- :param accepts: List of headers.
- :return: Accept (e.g. application/json).
- """
- if not accepts:
- return None
-
- for accept in accepts:
- if re.search("json", accept, re.IGNORECASE):
- return accept
-
- return accepts[0]
-
- def select_header_content_type(self, content_types):
- """Returns `Content-Type` based on an array of content_types provided.
-
- :param content_types: List of content-types.
- :return: Content-Type (e.g. application/json).
- """
- if not content_types:
- return None
-
- for content_type in content_types:
- if re.search("json", content_type, re.IGNORECASE):
- return content_type
-
- return content_types[0]
-
- def update_params_for_auth(
- self,
- headers,
- queries,
- auth_settings,
- resource_path,
- method,
- body,
- request_auth=None,
- ) -> None:
- """Updates header and query params based on authentication setting.
-
- :param headers: Header parameters dict to be updated.
- :param queries: Query parameters tuple list to be updated.
- :param auth_settings: Authentication setting identifiers list.
- :resource_path: A string representation of the HTTP request resource path.
- :method: A string representation of the HTTP request method.
- :body: A object representing the body of the HTTP request.
- The object type is the return value of sanitize_for_serialization().
- :param request_auth: if set, the provided settings will
- override the token in the configuration.
- """
- if not auth_settings:
- return
-
- if request_auth:
- self._apply_auth_params(
- headers, queries, resource_path, method, body, request_auth
- )
- else:
- for auth in auth_settings:
- auth_setting = self.configuration.auth_settings().get(auth)
- if auth_setting:
- self._apply_auth_params(
- headers, queries, resource_path, method, body, auth_setting
- )
-
- def _apply_auth_params(
- self, headers, queries, resource_path, method, body, auth_setting
- ) -> None:
- """Updates the request parameters based on a single auth_setting
-
- :param headers: Header parameters dict to be updated.
- :param queries: Query parameters tuple list to be updated.
- :resource_path: A string representation of the HTTP request resource path.
- :method: A string representation of the HTTP request method.
- :body: A object representing the body of the HTTP request.
- The object type is the return value of sanitize_for_serialization().
- :param auth_setting: auth settings for the endpoint
- """
- if auth_setting["in"] == "cookie":
- headers["Cookie"] = auth_setting["value"]
- elif auth_setting["in"] == "header":
- if auth_setting["type"] != "http-signature":
- headers[auth_setting["key"]] = auth_setting["value"]
- elif auth_setting["in"] == "query":
- queries.append((auth_setting["key"], auth_setting["value"]))
- else:
- raise ApiValueError("Authentication token must be in `query` or `header`")
-
- def __deserialize_file(self, response):
- """Deserializes body to file
-
- Saves response body into a file in a temporary folder,
- using the filename from the `Content-Disposition` header if provided.
-
- handle file downloading
- save response body into a tmp file and return the instance
-
- :param response: RESTResponse.
- :return: file path.
- """
- fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
- os.close(fd)
- os.remove(path)
-
- content_disposition = response.getheader("Content-Disposition")
- if content_disposition:
- filename = re.search(
- r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition
- ).group(1)
- path = os.path.join(os.path.dirname(path), filename)
-
- with open(path, "wb") as f:
- f.write(response.data)
-
- return path
-
- def __deserialize_primitive(self, data, klass):
- """Deserializes string to primitive type.
-
- :param data: str.
- :param klass: class literal.
-
- :return: int, long, float, str, bool.
- """
- try:
- return klass(data)
- except UnicodeEncodeError:
- return str(data)
- except TypeError:
- return data
-
- def __deserialize_object(self, value):
- """Return an original value.
-
- :return: object.
- """
- return value
-
- def __deserialize_date(self, string):
- """Deserializes string to date.
-
- :param string: str.
- :return: date.
- """
- try:
- return parse(string).date()
- except ImportError:
- return string
- except ValueError:
- raise rest.ApiException(
- status=0, reason="Failed to parse `{0}` as date object".format(string)
- )
-
- def __deserialize_datetime(self, string):
- """Deserializes string to datetime.
-
- The string should be in iso8601 datetime format.
-
- :param string: str.
- :return: datetime.
- """
- try:
- return parse(string)
- except ImportError:
- return string
- except ValueError:
- raise rest.ApiException(
- status=0,
- reason=("Failed to parse `{0}` as datetime object".format(string)),
- )
-
- def __deserialize_model(self, data, klass):
- """Deserializes list or dict to model.
-
- :param data: dict, list.
- :param klass: class literal.
- :return: model object.
- """
-
- return klass.from_dict(data)
diff --git a/packages/python-sdk/e2b/api/v2/client/api_response.py b/packages/python-sdk/e2b/api/v2/client/api_response.py
deleted file mode 100644
index f38555668..000000000
--- a/packages/python-sdk/e2b/api/v2/client/api_response.py
+++ /dev/null
@@ -1,22 +0,0 @@
-"""API response object."""
-
-from __future__ import annotations
-from typing import Any, Dict, Optional, Generic, TypeVar
-from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel
-
-T = TypeVar("T")
-
-
-class ApiResponse(BaseModel, Generic[T]):
- """
- API response object
- """
-
- status_code: StrictInt = Field(description="HTTP status code")
- headers: Optional[Dict[StrictStr, StrictStr]] = Field(
- None, description="HTTP headers"
- )
- data: T = Field(description="Deserialized data given the data type")
- raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
-
- model_config = {"arbitrary_types_allowed": True}
diff --git a/packages/python-sdk/e2b/api/v2/client/configuration.py b/packages/python-sdk/e2b/api/v2/client/configuration.py
deleted file mode 100644
index f5effea9a..000000000
--- a/packages/python-sdk/e2b/api/v2/client/configuration.py
+++ /dev/null
@@ -1,480 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import copy
-import logging
-import sys
-import urllib3
-
-import http.client as httplib
-
-JSON_SCHEMA_VALIDATION_KEYWORDS = {
- "multipleOf",
- "maximum",
- "exclusiveMaximum",
- "minimum",
- "exclusiveMinimum",
- "maxLength",
- "minLength",
- "pattern",
- "maxItems",
- "minItems",
-}
-
-
-class Configuration:
- """This class contains various settings of the API client.
-
- :param host: Base url.
- :param api_key: Dict to store API key(s).
- Each entry in the dict specifies an API key.
- The dict key is the name of the security scheme in the OAS specification.
- The dict value is the API key secret.
- :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
- The dict key is the name of the security scheme in the OAS specification.
- The dict value is an API key prefix when generating the auth data.
- :param username: Username for HTTP basic authentication.
- :param password: Password for HTTP basic authentication.
- :param access_token: Access token.
- :param server_index: Index to servers configuration.
- :param server_variables: Mapping with string values to replace variables in
- templated server configuration. The validation of enums is performed for
- variables with defined enum values before.
- :param server_operation_index: Mapping from operation ID to an index to server
- configuration.
- :param server_operation_variables: Mapping from operation ID to a mapping with
- string values to replace variables in templated server configuration.
- The validation of enums is performed for variables with defined enum
- values before.
- :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
- in PEM format.
-
- :Example:
-
- API Key Authentication Example.
- Given the following security scheme in the OpenAPI specification:
- components:
- securitySchemes:
- cookieAuth: # name for the security scheme
- type: apiKey
- in: cookie
- name: JSESSIONID # cookie name
-
- You can programmatically set the cookie:
-
- conf = e2b.api.v2.client.Configuration(
- api_key={'cookieAuth': 'abc123'}
- api_key_prefix={'cookieAuth': 'JSESSIONID'}
- )
-
- The following cookie will be added to the HTTP request:
- Cookie: JSESSIONID abc123
- """
-
- _default = None
-
- def __init__(
- self,
- host=None,
- api_key=None,
- api_key_prefix=None,
- username=None,
- password=None,
- access_token=None,
- server_index=None,
- server_variables=None,
- server_operation_index=None,
- server_operation_variables=None,
- ssl_ca_cert=None,
- ) -> None:
- """Constructor"""
- self._base_path = "https://api.e2b.dev" if host is None else host
- """Default Base url
- """
- self.server_index = 0 if server_index is None and host is None else server_index
- self.server_operation_index = server_operation_index or {}
- """Default server index
- """
- self.server_variables = server_variables or {}
- self.server_operation_variables = server_operation_variables or {}
- """Default server variables
- """
- self.temp_folder_path = None
- """Temp file folder for downloading files
- """
- # Authentication Settings
- self.api_key = {}
- if api_key:
- self.api_key = api_key
- """dict to store API key(s)
- """
- self.api_key_prefix = {}
- if api_key_prefix:
- self.api_key_prefix = api_key_prefix
- """dict to store API prefix (e.g. Bearer)
- """
- self.refresh_api_key_hook = None
- """function hook to refresh API key if expired
- """
- self.username = username
- """Username for HTTP basic authentication
- """
- self.password = password
- """Password for HTTP basic authentication
- """
- self.access_token = access_token
- """Access token
- """
- self.logger = {}
- """Logging Settings
- """
- self.logger["package_logger"] = logging.getLogger("e2b.api.v2.client")
- self.logger["urllib3_logger"] = logging.getLogger("urllib3")
- self.logger_format = "%(asctime)s %(levelname)s %(message)s"
- """Log format
- """
- self.logger_stream_handler = None
- """Log stream handler
- """
- self.logger_file_handler = None
- """Log file handler
- """
- self.logger_file = None
- """Debug file location
- """
- self.debug = False
- """Debug switch
- """
-
- self.verify_ssl = True
- """SSL/TLS verification
- Set this to false to skip verifying SSL certificate when calling API
- from https server.
- """
- self.ssl_ca_cert = ssl_ca_cert
- """Set this to customize the certificate file to verify the peer.
- """
- self.cert_file = None
- """client certificate file
- """
- self.key_file = None
- """client key file
- """
- self.assert_hostname = None
- """Set this to True/False to enable/disable SSL hostname verification.
- """
- self.tls_server_name = None
- """SSL/TLS Server Name Indication (SNI)
- Set this to the SNI value expected by the server.
- """
-
- self.proxy = None
- """Proxy URL
- """
- self.proxy_headers = None
- """Proxy headers
- """
- self.safe_chars_for_path_param = ""
- """Safe chars for path_param
- """
- self.retries = None
- """Adding retries to override urllib3 default value 3
- """
- # Enable client side validation
- self.client_side_validation = True
-
- self.socket_options = None
- """Options to pass down to the underlying urllib3 socket
- """
-
- self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
- """datetime format
- """
-
- self.date_format = "%Y-%m-%d"
- """date format
- """
-
- def __deepcopy__(self, memo):
- cls = self.__class__
- result = cls.__new__(cls)
- memo[id(self)] = result
- for k, v in self.__dict__.items():
- if k not in ("logger", "logger_file_handler"):
- setattr(result, k, copy.deepcopy(v, memo))
- # shallow copy of loggers
- result.logger = copy.copy(self.logger)
- # use setters to configure loggers
- result.logger_file = self.logger_file
- result.debug = self.debug
- return result
-
- def __setattr__(self, name, value):
- object.__setattr__(self, name, value)
-
- @classmethod
- def set_default(cls, default):
- """Set default instance of configuration.
-
- It stores default configuration, which can be
- returned by get_default_copy method.
-
- :param default: object of Configuration
- """
- cls._default = default
-
- @classmethod
- def get_default_copy(cls):
- """Deprecated. Please use `get_default` instead.
-
- Deprecated. Please use `get_default` instead.
-
- :return: The configuration object.
- """
- return cls.get_default()
-
- @classmethod
- def get_default(cls):
- """Return the default configuration.
-
- This method returns newly created, based on default constructor,
- object of Configuration class or returns a copy of default
- configuration.
-
- :return: The configuration object.
- """
- if cls._default is None:
- cls._default = Configuration()
- return cls._default
-
- @property
- def logger_file(self):
- """The logger file.
-
- If the logger_file is None, then add stream handler and remove file
- handler. Otherwise, add file handler and remove stream handler.
-
- :param value: The logger_file path.
- :type: str
- """
- return self.__logger_file
-
- @logger_file.setter
- def logger_file(self, value):
- """The logger file.
-
- If the logger_file is None, then add stream handler and remove file
- handler. Otherwise, add file handler and remove stream handler.
-
- :param value: The logger_file path.
- :type: str
- """
- self.__logger_file = value
- if self.__logger_file:
- # If set logging file,
- # then add file handler and remove stream handler.
- self.logger_file_handler = logging.FileHandler(self.__logger_file)
- self.logger_file_handler.setFormatter(self.logger_formatter)
- for _, logger in self.logger.items():
- logger.addHandler(self.logger_file_handler)
-
- @property
- def debug(self):
- """Debug status
-
- :param value: The debug status, True or False.
- :type: bool
- """
- return self.__debug
-
- @debug.setter
- def debug(self, value):
- """Debug status
-
- :param value: The debug status, True or False.
- :type: bool
- """
- self.__debug = value
- if self.__debug:
- # if debug status is True, turn on debug logging
- for _, logger in self.logger.items():
- logger.setLevel(logging.DEBUG)
- # turn on httplib debug
- httplib.HTTPConnection.debuglevel = 1
- else:
- # if debug status is False, turn off debug logging,
- # setting log level to default `logging.WARNING`
- for _, logger in self.logger.items():
- logger.setLevel(logging.WARNING)
- # turn off httplib debug
- httplib.HTTPConnection.debuglevel = 0
-
- @property
- def logger_format(self):
- """The logger format.
-
- The logger_formatter will be updated when sets logger_format.
-
- :param value: The format string.
- :type: str
- """
- return self.__logger_format
-
- @logger_format.setter
- def logger_format(self, value):
- """The logger format.
-
- The logger_formatter will be updated when sets logger_format.
-
- :param value: The format string.
- :type: str
- """
- self.__logger_format = value
- self.logger_formatter = logging.Formatter(self.__logger_format)
-
- def get_api_key_with_prefix(self, identifier, alias=None):
- """Gets API key (with prefix if set).
-
- :param identifier: The identifier of apiKey.
- :param alias: The alternative identifier of apiKey.
- :return: The token for api key authentication.
- """
- if self.refresh_api_key_hook is not None:
- self.refresh_api_key_hook(self)
- key = self.api_key.get(
- identifier, self.api_key.get(alias) if alias is not None else None
- )
- if key:
- prefix = self.api_key_prefix.get(identifier)
- if prefix:
- return "%s %s" % (prefix, key)
- else:
- return key
-
- def get_basic_auth_token(self):
- """Gets HTTP basic authentication header (string).
-
- :return: The token for basic HTTP authentication.
- """
- username = ""
- if self.username is not None:
- username = self.username
- password = ""
- if self.password is not None:
- password = self.password
- return urllib3.util.make_headers(basic_auth=username + ":" + password).get(
- "authorization"
- )
-
- def auth_settings(self):
- """Gets Auth Settings dict for api client.
-
- :return: The Auth Settings information dict.
- """
- auth = {}
- if "ApiKeyAuth" in self.api_key:
- auth["ApiKeyAuth"] = {
- "type": "api_key",
- "in": "header",
- "key": "X-API-Key",
- "value": self.get_api_key_with_prefix(
- "ApiKeyAuth",
- ),
- }
- if self.access_token is not None:
- auth["AccessTokenAuth"] = {
- "type": "bearer",
- "in": "header",
- "format": "access_token",
- "key": "Authorization",
- "value": "Bearer " + self.access_token,
- }
- return auth
-
- def to_debug_report(self):
- """Gets the essential information for debugging.
-
- :return: The report for debugging.
- """
- return (
- "Python SDK Debug Report:\n"
- "OS: {env}\n"
- "Python Version: {pyversion}\n"
- "Version of the API: 0.1.0\n"
- "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version)
- )
-
- def get_host_settings(self):
- """Gets an array of host settings
-
- :return: An array of host settings
- """
- return [
- {
- "url": "https://api.e2b.dev",
- "description": "No description provided",
- }
- ]
-
- def get_host_from_settings(self, index, variables=None, servers=None):
- """Gets host URL based on the index and variables
- :param index: array index of the host settings
- :param variables: hash of variable and the corresponding value
- :param servers: an array of host settings or None
- :return: URL based on host settings
- """
- if index is None:
- return self._base_path
-
- variables = {} if variables is None else variables
- servers = self.get_host_settings() if servers is None else servers
-
- try:
- server = servers[index]
- except IndexError:
- raise ValueError(
- "Invalid index {0} when selecting the host settings. "
- "Must be less than {1}".format(index, len(servers))
- )
-
- url = server["url"]
-
- # go through variables and replace placeholders
- for variable_name, variable in server.get("variables", {}).items():
- used_value = variables.get(variable_name, variable["default_value"])
-
- if "enum_values" in variable and used_value not in variable["enum_values"]:
- raise ValueError(
- "The variable `{0}` in the host URL has invalid value "
- "{1}. Must be {2}.".format(
- variable_name, variables[variable_name], variable["enum_values"]
- )
- )
-
- url = url.replace("{" + variable_name + "}", used_value)
-
- return url
-
- @property
- def host(self):
- """Return generated host."""
- return self.get_host_from_settings(
- self.server_index, variables=self.server_variables
- )
-
- @host.setter
- def host(self, value):
- """Fix base path."""
- self._base_path = value
- self.server_index = None
diff --git a/packages/python-sdk/e2b/api/v2/client/exceptions.py b/packages/python-sdk/e2b/api/v2/client/exceptions.py
deleted file mode 100644
index af0c9a08b..000000000
--- a/packages/python-sdk/e2b/api/v2/client/exceptions.py
+++ /dev/null
@@ -1,161 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-class OpenApiException(Exception):
- """The base exception class for all OpenAPIExceptions"""
-
-
-class ApiTypeError(OpenApiException, TypeError):
- def __init__(
- self, msg, path_to_item=None, valid_classes=None, key_type=None
- ) -> None:
- """Raises an exception for TypeErrors
-
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (list): a list of keys an indices to get to the
- current_item
- None if unset
- valid_classes (tuple): the primitive classes that current item
- should be an instance of
- None if unset
- key_type (bool): False if our value is a value in a dict
- True if it is a key in a dict
- False if our item is an item in a list
- None if unset
- """
- self.path_to_item = path_to_item
- self.valid_classes = valid_classes
- self.key_type = key_type
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiTypeError, self).__init__(full_msg)
-
-
-class ApiValueError(OpenApiException, ValueError):
- def __init__(self, msg, path_to_item=None) -> None:
- """
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (list) the path to the exception in the
- received_data dict. None if unset
- """
-
- self.path_to_item = path_to_item
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiValueError, self).__init__(full_msg)
-
-
-class ApiAttributeError(OpenApiException, AttributeError):
- def __init__(self, msg, path_to_item=None) -> None:
- """
- Raised when an attribute reference or assignment fails.
-
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (None/list) the path to the exception in the
- received_data dict
- """
- self.path_to_item = path_to_item
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiAttributeError, self).__init__(full_msg)
-
-
-class ApiKeyError(OpenApiException, KeyError):
- def __init__(self, msg, path_to_item=None) -> None:
- """
- Args:
- msg (str): the exception message
-
- Keyword Args:
- path_to_item (None/list) the path to the exception in the
- received_data dict
- """
- self.path_to_item = path_to_item
- full_msg = msg
- if path_to_item:
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
- super(ApiKeyError, self).__init__(full_msg)
-
-
-class ApiException(OpenApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- if http_resp:
- self.status = http_resp.status
- self.reason = http_resp.reason
- self.body = http_resp.data.decode("utf-8")
- self.headers = http_resp.getheaders()
- else:
- self.status = status
- self.reason = reason
- self.body = None
- self.headers = None
-
- def __str__(self):
- """Custom error messages for exception"""
- error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
- if self.headers:
- error_message += "HTTP response headers: {0}\n".format(self.headers)
-
- if self.body:
- error_message += "HTTP response body: {0}\n".format(self.body)
-
- return error_message
-
-
-class BadRequestException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(BadRequestException, self).__init__(status, reason, http_resp)
-
-
-class NotFoundException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(NotFoundException, self).__init__(status, reason, http_resp)
-
-
-class UnauthorizedException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(UnauthorizedException, self).__init__(status, reason, http_resp)
-
-
-class ForbiddenException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(ForbiddenException, self).__init__(status, reason, http_resp)
-
-
-class ServiceException(ApiException):
- def __init__(self, status=None, reason=None, http_resp=None) -> None:
- super(ServiceException, self).__init__(status, reason, http_resp)
-
-
-def render_path(path_to_item):
- """Returns a string representation of a path"""
- result = ""
- for pth in path_to_item:
- if isinstance(pth, int):
- result += "[{0}]".format(pth)
- else:
- result += "['{0}']".format(pth)
- return result
diff --git a/packages/python-sdk/e2b/api/v2/client/models/__init__.py b/packages/python-sdk/e2b/api/v2/client/models/__init__.py
deleted file mode 100644
index 4946b684c..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/__init__.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-# import models into model package
-from e2b.api.v2.client.models.error import Error
-from e2b.api.v2.client.models.new_sandbox import NewSandbox
-from e2b.api.v2.client.models.running_sandbox import RunningSandbox
-from e2b.api.v2.client.models.sandbox import Sandbox
-from e2b.api.v2.client.models.sandbox_log import SandboxLog
-from e2b.api.v2.client.models.sandbox_logs import SandboxLogs
-from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (
- SandboxesSandboxIDRefreshesPostRequest,
-)
-from e2b.api.v2.client.models.sandboxes_sandbox_id_timeout_post_request import (
- SandboxesSandboxIDTimeoutPostRequest,
-)
-from e2b.api.v2.client.models.template import Template
-from e2b.api.v2.client.models.template_build import TemplateBuild
-from e2b.api.v2.client.models.template_build_request import TemplateBuildRequest
diff --git a/packages/python-sdk/e2b/api/v2/client/models/error.py b/packages/python-sdk/e2b/api/v2/client/models/error.py
deleted file mode 100644
index 8db6d01c5..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/error.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List
-from pydantic import BaseModel, StrictInt, StrictStr
-from pydantic import Field
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class Error(BaseModel):
- """
- Error
- """ # noqa: E501
-
- code: StrictInt = Field(description="Error code")
- message: StrictStr = Field(description="Error")
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["code", "message"]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Error from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Error from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {"code": obj.get("code"), "message": obj.get("message")}
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/v2/client/models/new_sandbox.py
deleted file mode 100644
index aafac2ba2..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/new_sandbox.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List, Optional
-from pydantic import BaseModel, StrictStr
-from pydantic import Field
-from typing_extensions import Annotated
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class NewSandbox(BaseModel):
- """
- NewSandbox
- """ # noqa: E501
-
- template_id: StrictStr = Field(
- description="Identifier of the required template", alias="templateID"
- )
- timeout: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
- default=15, description="Time to live for the sandbox in seconds."
- )
- metadata: Optional[Dict[str, StrictStr]] = None
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["templateID", "timeout", "metadata"]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NewSandbox from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NewSandbox from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "templateID": obj.get("templateID"),
- "timeout": obj.get("timeout") if obj.get("timeout") is not None else 15,
- "metadata": obj.get("metadata"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/running_sandbox.py b/packages/python-sdk/e2b/api/v2/client/models/running_sandbox.py
deleted file mode 100644
index 396a4ead1..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/running_sandbox.py
+++ /dev/null
@@ -1,139 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-from datetime import datetime
-from typing import Any, ClassVar, Dict, List, Optional
-from pydantic import BaseModel, StrictStr
-from pydantic import Field
-from typing_extensions import Annotated
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class RunningSandbox(BaseModel):
- """
- RunningSandbox
- """ # noqa: E501
-
- template_id: StrictStr = Field(
- description="Identifier of the template from which is the sandbox created",
- alias="templateID",
- )
- alias: Optional[StrictStr] = Field(
- default=None, description="Alias of the template"
- )
- sandbox_id: StrictStr = Field(
- description="Identifier of the sandbox", alias="sandboxID"
- )
- client_id: StrictStr = Field(
- description="Identifier of the client", alias="clientID"
- )
- started_at: datetime = Field(
- description="Time when the sandbox was started", alias="startedAt"
- )
- cpu_count: Annotated[int, Field(le=8, strict=True, ge=1)] = Field(
- description="CPU cores for the sandbox", alias="cpuCount"
- )
- memory_mb: Annotated[int, Field(le=8192, strict=True, ge=128)] = Field(
- description="Memory for the sandbox in MB", alias="memoryMB"
- )
- metadata: Optional[Dict[str, StrictStr]] = None
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = [
- "templateID",
- "alias",
- "sandboxID",
- "clientID",
- "startedAt",
- "cpuCount",
- "memoryMB",
- "metadata",
- ]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RunningSandbox from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RunningSandbox from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "templateID": obj.get("templateID"),
- "alias": obj.get("alias"),
- "sandboxID": obj.get("sandboxID"),
- "clientID": obj.get("clientID"),
- "startedAt": obj.get("startedAt"),
- "cpuCount": obj.get("cpuCount"),
- "memoryMB": obj.get("memoryMB"),
- "metadata": obj.get("metadata"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/sandbox.py b/packages/python-sdk/e2b/api/v2/client/models/sandbox.py
deleted file mode 100644
index 0f2abc608..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/sandbox.py
+++ /dev/null
@@ -1,125 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List, Optional
-from pydantic import BaseModel, StrictStr
-from pydantic import Field
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class Sandbox(BaseModel):
- """
- Sandbox
- """ # noqa: E501
-
- template_id: StrictStr = Field(
- description="Identifier of the template from which is the sandbox created",
- alias="templateID",
- )
- sandbox_id: StrictStr = Field(
- description="Identifier of the sandbox", alias="sandboxID"
- )
- alias: Optional[StrictStr] = Field(
- default=None, description="Alias of the template"
- )
- client_id: StrictStr = Field(
- description="Identifier of the client", alias="clientID"
- )
- envd_version: StrictStr = Field(
- description="Version of the envd running in the sandbox", alias="envdVersion"
- )
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = [
- "templateID",
- "sandboxID",
- "alias",
- "clientID",
- "envdVersion",
- ]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Sandbox from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Sandbox from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "templateID": obj.get("templateID"),
- "sandboxID": obj.get("sandboxID"),
- "alias": obj.get("alias"),
- "clientID": obj.get("clientID"),
- "envdVersion": obj.get("envdVersion"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/sandbox_log.py b/packages/python-sdk/e2b/api/v2/client/models/sandbox_log.py
deleted file mode 100644
index 1dc6d47f2..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/sandbox_log.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-from datetime import datetime
-from typing import Any, ClassVar, Dict, List
-from pydantic import BaseModel, StrictStr
-from pydantic import Field
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class SandboxLog(BaseModel):
- """
- Log entry with timestamp and line
- """ # noqa: E501
-
- timestamp: datetime = Field(description="Timestamp of the log entry")
- line: StrictStr = Field(description="Log line content")
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["timestamp", "line"]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SandboxLog from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of SandboxLog from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {"timestamp": obj.get("timestamp"), "line": obj.get("line")}
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/v2/client/models/sandbox_logs.py
deleted file mode 100644
index a9f0064cb..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/sandbox_logs.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List
-from pydantic import BaseModel
-from pydantic import Field
-from e2b.api.v2.client.models.sandbox_log import SandboxLog
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class SandboxLogs(BaseModel):
- """
- SandboxLogs
- """ # noqa: E501
-
- logs: List[SandboxLog] = Field(description="Logs of the sandbox")
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["logs"]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SandboxLogs from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # override the default output from pydantic by calling `to_dict()` of each item in logs (list)
- _items = []
- if self.logs:
- for _item in self.logs:
- if _item:
- _items.append(_item.to_dict())
- _dict["logs"] = _items
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of SandboxLogs from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "logs": [SandboxLog.from_dict(_item) for _item in obj.get("logs")]
- if obj.get("logs") is not None
- else None
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_refreshes_post_request.py b/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_refreshes_post_request.py
deleted file mode 100644
index 0f16bd8f9..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_refreshes_post_request.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List, Optional
-from pydantic import BaseModel
-from pydantic import Field
-from typing_extensions import Annotated
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class SandboxesSandboxIDRefreshesPostRequest(BaseModel):
- """
- SandboxesSandboxIDRefreshesPostRequest
- """ # noqa: E501
-
- duration: Optional[Annotated[int, Field(le=3600, strict=True, ge=0)]] = Field(
- default=None,
- description="Duration for which the sandbox should be kept alive in seconds",
- )
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["duration"]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate({"duration": obj.get("duration")})
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_timeout_post_request.py b/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_timeout_post_request.py
deleted file mode 100644
index 1c52c913f..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_timeout_post_request.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List
-from pydantic import BaseModel
-from pydantic import Field
-from typing_extensions import Annotated
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class SandboxesSandboxIDTimeoutPostRequest(BaseModel):
- """
- SandboxesSandboxIDTimeoutPostRequest
- """ # noqa: E501
-
- timeout: Annotated[int, Field(strict=True, ge=0)] = Field(
- description="Timeout in seconds from the current time after which the sandbox should expire"
- )
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["timeout"]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SandboxesSandboxIDTimeoutPostRequest from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of SandboxesSandboxIDTimeoutPostRequest from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate({"timeout": obj.get("timeout")})
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/template.py b/packages/python-sdk/e2b/api/v2/client/models/template.py
deleted file mode 100644
index 7ae80a8aa..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/template.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List, Optional
-from pydantic import BaseModel, StrictBool, StrictStr
-from pydantic import Field
-from typing_extensions import Annotated
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class Template(BaseModel):
- """
- Template
- """ # noqa: E501
-
- template_id: StrictStr = Field(
- description="Identifier of the template", alias="templateID"
- )
- build_id: StrictStr = Field(
- description="Identifier of the last successful build for given template",
- alias="buildID",
- )
- cpu_count: Annotated[int, Field(le=8, strict=True, ge=1)] = Field(
- description="CPU cores for the sandbox", alias="cpuCount"
- )
- memory_mb: Annotated[int, Field(le=8192, strict=True, ge=128)] = Field(
- description="Memory for the sandbox in MB", alias="memoryMB"
- )
- public: StrictBool = Field(
- description="Whether the template is public or only accessible by the team"
- )
- aliases: Optional[List[StrictStr]] = Field(
- default=None, description="Aliases of the template"
- )
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = [
- "templateID",
- "buildID",
- "cpuCount",
- "memoryMB",
- "public",
- "aliases",
- ]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Template from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Template from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "templateID": obj.get("templateID"),
- "buildID": obj.get("buildID"),
- "cpuCount": obj.get("cpuCount"),
- "memoryMB": obj.get("memoryMB"),
- "public": obj.get("public"),
- "aliases": obj.get("aliases"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/template_build.py b/packages/python-sdk/e2b/api/v2/client/models/template_build.py
deleted file mode 100644
index 318fa13a3..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/template_build.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List
-from pydantic import BaseModel, StrictStr, field_validator
-from pydantic import Field
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class TemplateBuild(BaseModel):
- """
- TemplateBuild
- """ # noqa: E501
-
- logs: List[StrictStr] = Field(description="Build logs")
- template_id: StrictStr = Field(
- description="Identifier of the template", alias="templateID"
- )
- build_id: StrictStr = Field(description="Identifier of the build", alias="buildID")
- status: StrictStr = Field(description="Status of the template")
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = ["logs", "templateID", "buildID", "status"]
-
- @field_validator("status")
- def status_validate_enum(cls, value):
- """Validates the enum"""
- if value not in ("building", "ready", "error"):
- raise ValueError(
- "must be one of enum values ('building', 'ready', 'error')"
- )
- return value
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of TemplateBuild from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of TemplateBuild from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "logs": obj.get("logs"),
- "templateID": obj.get("templateID"),
- "buildID": obj.get("buildID"),
- "status": obj.get("status"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/models/template_build_request.py b/packages/python-sdk/e2b/api/v2/client/models/template_build_request.py
deleted file mode 100644
index 0c631058a..000000000
--- a/packages/python-sdk/e2b/api/v2/client/models/template_build_request.py
+++ /dev/null
@@ -1,125 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-from __future__ import annotations
-import pprint
-import re # noqa: F401
-import json
-
-
-from typing import Any, ClassVar, Dict, List, Optional
-from pydantic import BaseModel, StrictStr
-from pydantic import Field
-from typing_extensions import Annotated
-
-try:
- from typing import Self
-except ImportError:
- from typing_extensions import Self
-
-
-class TemplateBuildRequest(BaseModel):
- """
- TemplateBuildRequest
- """ # noqa: E501
-
- alias: Optional[StrictStr] = Field(
- default=None, description="Alias of the template"
- )
- dockerfile: StrictStr = Field(description="Dockerfile for the template")
- start_cmd: Optional[StrictStr] = Field(
- default=None,
- description="Start command to execute in the template after the build",
- alias="startCmd",
- )
- cpu_count: Optional[Annotated[int, Field(le=8, strict=True, ge=1)]] = Field(
- default=None, description="CPU cores for the sandbox", alias="cpuCount"
- )
- memory_mb: Optional[Annotated[int, Field(le=8192, strict=True, ge=128)]] = Field(
- default=None, description="Memory for the sandbox in MB", alias="memoryMB"
- )
- additional_properties: Dict[str, Any] = {}
- __properties: ClassVar[List[str]] = [
- "alias",
- "dockerfile",
- "startCmd",
- "cpuCount",
- "memoryMB",
- ]
-
- model_config = {"populate_by_name": True, "validate_assignment": True}
-
- def to_str(self) -> str:
- """Returns the string representation of the model using alias"""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Returns the JSON representation of the model using alias"""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict())
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of TemplateBuildRequest from a JSON string"""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Return the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- * Fields in `self.additional_properties` are added to the output dict.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={
- "additional_properties",
- },
- exclude_none=True,
- )
- # puts key-value pairs in additional_properties in the top level
- if self.additional_properties is not None:
- for _key, _value in self.additional_properties.items():
- _dict[_key] = _value
-
- return _dict
-
- @classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of TemplateBuildRequest from a dict"""
- if obj is None:
- return None
-
- if not isinstance(obj, dict):
- return cls.model_validate(obj)
-
- _obj = cls.model_validate(
- {
- "alias": obj.get("alias"),
- "dockerfile": obj.get("dockerfile"),
- "startCmd": obj.get("startCmd"),
- "cpuCount": obj.get("cpuCount"),
- "memoryMB": obj.get("memoryMB"),
- }
- )
- # store additional fields in additional_properties
- for _key in obj.keys():
- if _key not in cls.__properties:
- _obj.additional_properties[_key] = obj.get(_key)
-
- return _obj
diff --git a/packages/python-sdk/e2b/api/v2/client/rest.py b/packages/python-sdk/e2b/api/v2/client/rest.py
deleted file mode 100644
index 1bdeb9e07..000000000
--- a/packages/python-sdk/e2b/api/v2/client/rest.py
+++ /dev/null
@@ -1,211 +0,0 @@
-# coding: utf-8
-
-"""
- E2B API
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
- The version of the OpenAPI document: 0.1.0
- Generated by OpenAPI Generator (https://openapi-generator.tech)
-
- Do not edit the class manually.
-""" # noqa: E501
-
-
-import io
-import json
-import re
-import ssl
-
-import urllib3
-
-from e2b.api.v2.client.exceptions import ApiException, ApiValueError
-
-RESTResponseType = urllib3.HTTPResponse
-
-
-class RESTResponse(io.IOBase):
- def __init__(self, resp) -> None:
- self.response = resp
- self.status = resp.status
- self.reason = resp.reason
- self.data = None
-
- def read(self):
- if self.data is None:
- self.data = self.response.data
- return self.data
-
- def getheaders(self):
- """Returns a dictionary of the response headers."""
- return self.response.headers
-
- def getheader(self, name, default=None):
- """Returns a given response header."""
- return self.response.headers.get(name, default)
-
-
-class RESTClientObject:
- def __init__(self, configuration) -> None:
- # urllib3.PoolManager will pass all kw parameters to connectionpool
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
- # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
- # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
-
- # cert_reqs
- if configuration.verify_ssl:
- cert_reqs = ssl.CERT_REQUIRED
- else:
- cert_reqs = ssl.CERT_NONE
-
- addition_pool_args = {}
- if configuration.assert_hostname is not None:
- addition_pool_args["assert_hostname"] = configuration.assert_hostname
-
- if configuration.retries is not None:
- addition_pool_args["retries"] = configuration.retries
-
- if configuration.tls_server_name:
- addition_pool_args["server_hostname"] = configuration.tls_server_name
-
- if configuration.socket_options is not None:
- addition_pool_args["socket_options"] = configuration.socket_options
-
- # https pool manager
- if configuration.proxy:
- self.pool_manager = urllib3.ProxyManager(
- cert_reqs=cert_reqs,
- ca_certs=configuration.ssl_ca_cert,
- cert_file=configuration.cert_file,
- key_file=configuration.key_file,
- proxy_url=configuration.proxy,
- proxy_headers=configuration.proxy_headers,
- **addition_pool_args
- )
- else:
- self.pool_manager = urllib3.PoolManager(
- cert_reqs=cert_reqs,
- ca_certs=configuration.ssl_ca_cert,
- cert_file=configuration.cert_file,
- key_file=configuration.key_file,
- **addition_pool_args
- )
-
- def request(
- self,
- method,
- url,
- headers=None,
- body=None,
- post_params=None,
- _request_timeout=None,
- ):
- """Perform requests.
-
- :param method: http request method
- :param url: http request url
- :param headers: http request headers
- :param body: request json body, for `application/json`
- :param post_params: request post parameters,
- `application/x-www-form-urlencoded`
- and `multipart/form-data`
- :param _request_timeout: timeout setting for this request. If one
- number provided, it will be total request
- timeout. It can also be a pair (tuple) of
- (connection, read) timeouts.
- """
- method = method.upper()
- assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
-
- if post_params and body:
- raise ApiValueError(
- "body parameter cannot be used with post_params parameter."
- )
-
- post_params = post_params or {}
- headers = headers or {}
-
- timeout = None
- if _request_timeout:
- if isinstance(_request_timeout, (int, float)):
- timeout = urllib3.Timeout(total=_request_timeout)
- elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
- timeout = urllib3.Timeout(
- connect=_request_timeout[0], read=_request_timeout[1]
- )
-
- try:
- # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
- if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
- # no content type provided or payload is json
- content_type = headers.get("Content-Type")
- if not content_type or re.search("json", content_type, re.IGNORECASE):
- request_body = None
- if body is not None:
- request_body = json.dumps(body)
- r = self.pool_manager.request(
- method,
- url,
- body=request_body,
- timeout=timeout,
- headers=headers,
- preload_content=False,
- )
- elif content_type == "application/x-www-form-urlencoded":
- r = self.pool_manager.request(
- method,
- url,
- fields=post_params,
- encode_multipart=False,
- timeout=timeout,
- headers=headers,
- preload_content=False,
- )
- elif content_type == "multipart/form-data":
- # must del headers['Content-Type'], or the correct
- # Content-Type which generated by urllib3 will be
- # overwritten.
- del headers["Content-Type"]
- r = self.pool_manager.request(
- method,
- url,
- fields=post_params,
- encode_multipart=True,
- timeout=timeout,
- headers=headers,
- preload_content=False,
- )
- # Pass a `string` parameter directly in the body to support
- # other content types than Json when `body` argument is
- # provided in serialized form
- elif isinstance(body, str) or isinstance(body, bytes):
- request_body = body
- r = self.pool_manager.request(
- method,
- url,
- body=request_body,
- timeout=timeout,
- headers=headers,
- preload_content=False,
- )
- else:
- # Cannot generate the request from given parameters
- msg = """Cannot prepare a request message for provided
- arguments. Please check that your arguments match
- declared content type."""
- raise ApiException(status=0, reason=msg)
- # For `GET`, `HEAD`
- else:
- r = self.pool_manager.request(
- method,
- url,
- fields={},
- timeout=timeout,
- headers=headers,
- preload_content=False,
- )
- except urllib3.exceptions.SSLError as e:
- msg = "\n".join([type(e).__name__, str(e)])
- raise ApiException(status=0, reason=msg)
-
- return RESTResponse(r)
diff --git a/packages/python-sdk/e2b/api/v2/client_README.md b/packages/python-sdk/e2b/api/v2/client_README.md
deleted file mode 100644
index 5f94b028d..000000000
--- a/packages/python-sdk/e2b/api/v2/client_README.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# e2b.api.v2.client
-No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
-The `e2b.api.v2.client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
-
-- API version: 0.1.0
-- Package version: 1.0.0
-- Build package: org.openapitools.codegen.languages.PythonClientCodegen
-
-## Requirements.
-
-Python 3.7+
-
-## Installation & Usage
-
-This python library package is generated without supporting files like setup.py or requirements files
-
-To be able to use it, you will need these dependencies in your own package that uses this library:
-
-* urllib3 >= 1.25.3
-* python-dateutil
-* pydantic
-
-## Getting Started
-
-In your own code, to use this library to connect and interact with e2b.api.v2.client,
-you can run the following:
-
-```python
-
-import time
-import e2b.api.v2.client
-from e2b.api.v2.client.rest import ApiException
-from pprint import pprint
-
-# Defining the host is optional and defaults to https://api.e2b.dev
-# See configuration.py for a list of all supported configuration parameters.
-configuration = e2b.api.v2.client.Configuration(
- host = "https://api.e2b.dev"
-)
-
-# The client must configure the authentication and authorization parameters
-# in accordance with the API server security policy.
-# Examples for each auth method are provided below, use the example that
-# satisfies your auth use case.
-
-# Configure API key authorization: ApiKeyAuth
-configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]
-
-# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
-# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'
-
-
-# Enter a context with an instance of the API client
-with e2b.api.v2.client.ApiClient(configuration) as api_client:
- # Create an instance of the API class
- api_instance = e2b.api.v2.client.SandboxesApi(api_client)
-
- try:
- api_response = api_instance.sandboxes_get()
- print("The response of SandboxesApi->sandboxes_get:\n")
- pprint(api_response)
- except ApiException as e:
- print("Exception when calling SandboxesApi->sandboxes_get: %s\n" % e)
-
-```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *https://api.e2b.dev*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-*SandboxesApi* | [**sandboxes_get**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_get) | **GET** /sandboxes |
-*SandboxesApi* | [**sandboxes_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_post) | **POST** /sandboxes |
-*SandboxesApi* | [**sandboxes_sandbox_id_delete**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_delete) | **DELETE** /sandboxes/{sandboxID} |
-*SandboxesApi* | [**sandboxes_sandbox_id_logs_get**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_logs_get) | **GET** /sandboxes/{sandboxID}/logs |
-*SandboxesApi* | [**sandboxes_sandbox_id_refreshes_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_refreshes_post) | **POST** /sandboxes/{sandboxID}/refreshes |
-*SandboxesApi* | [**sandboxes_sandbox_id_timeout_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_timeout_post) | **POST** /sandboxes/{sandboxID}/timeout |
-
-
-## Documentation For Models
-
- - [Error](e2b/api/v2/client/docs/Error.md)
- - [NewSandbox](e2b/api/v2/client/docs/NewSandbox.md)
- - [RunningSandbox](e2b/api/v2/client/docs/RunningSandbox.md)
- - [Sandbox](e2b/api/v2/client/docs/Sandbox.md)
- - [SandboxLog](e2b/api/v2/client/docs/SandboxLog.md)
- - [SandboxLogs](e2b/api/v2/client/docs/SandboxLogs.md)
- - [SandboxesSandboxIDRefreshesPostRequest](e2b/api/v2/client/docs/SandboxesSandboxIDRefreshesPostRequest.md)
- - [SandboxesSandboxIDTimeoutPostRequest](e2b/api/v2/client/docs/SandboxesSandboxIDTimeoutPostRequest.md)
- - [Template](e2b/api/v2/client/docs/Template.md)
- - [TemplateBuild](e2b/api/v2/client/docs/TemplateBuild.md)
- - [TemplateBuildRequest](e2b/api/v2/client/docs/TemplateBuildRequest.md)
-
-
-<a id="documentation-for-authorization"></a>
-## Documentation For Authorization
-
-
-Authentication schemes defined for the API:
-<a id="ApiKeyAuth"></a>
-### ApiKeyAuth
-
-- **Type**: API key
-- **API key parameter name**: X-API-Key
-- **Location**: HTTP header
-
-<a id="AccessTokenAuth"></a>
-### AccessTokenAuth
-
-- **Type**: Bearer authentication (access_token)
-
-
-## Author
-
-
-
-
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py b/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
index 4ae947e7b..b0c85f83e 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
@@ -1,5 +1,5 @@
# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
-from typing import Any, Generator, Coroutine, AsyncGenerator
+from typing import Any, Generator, Coroutine, AsyncGenerator, Optional
from httpcore import ConnectionPool, AsyncConnectionPool
import connect
@@ -10,7 +10,7 @@ FilesystemName = "filesystem.Filesystem"
class FilesystemClient:
- def __init__(self, base_url: str, *, pool: ConnectionPool, async_pool: AsyncConnectionPool, compressor=None, json=False, **opts):
+ def __init__(self, base_url: str, *, pool: Optional[ConnectionPool] = None, async_pool: Optional[AsyncConnectionPool] = None, compressor=None, json=False, **opts):
self._stat = connect.Client(
pool=pool,
async_pool=async_pool,
diff --git a/packages/python-sdk/e2b/envd/process/process_connect.py b/packages/python-sdk/e2b/envd/process/process_connect.py
index caccd8fc1..d3dbcafa0 100644
--- a/packages/python-sdk/e2b/envd/process/process_connect.py
+++ b/packages/python-sdk/e2b/envd/process/process_connect.py
@@ -1,5 +1,5 @@
# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
-from typing import Any, Generator, Coroutine, AsyncGenerator
+from typing import Any, Generator, Coroutine, AsyncGenerator, Optional
from httpcore import ConnectionPool, AsyncConnectionPool
import connect
@@ -10,7 +10,7 @@ ProcessName = "process.Process"
class ProcessClient:
- def __init__(self, base_url: str, *, pool: ConnectionPool, async_pool: AsyncConnectionPool, compressor=None, json=False, **opts):
+ def __init__(self, base_url: str, *, pool: Optional[ConnectionPool] = None, async_pool: Optional[AsyncConnectionPool] = None, compressor=None, json=False, **opts):
self._list = connect.Client(
pool=pool,
async_pool=async_pool,
diff --git a/packages/python-sdk/e2b/sandbox/sandbox_api.py b/packages/python-sdk/e2b/sandbox/sandbox_api.py
index e45fb3b57..caafa00c8 100644
--- a/packages/python-sdk/e2b/sandbox/sandbox_api.py
+++ b/packages/python-sdk/e2b/sandbox/sandbox_api.py
@@ -4,7 +4,14 @@ from datetime import datetime
from packaging.version import Version
from e2b.exceptions import TemplateException
-from e2b.api import ApiClient, models, client, exceptions
+from e2b.api import ApiClient
+from e2b.api.client.models import NewSandbox, PostSandboxesSandboxIDTimeoutBody
+from e2b.api.client.api.sandboxes import (
+ post_sandboxes_sandbox_id_timeout,
+ get_sandboxes,
+ delete_sandboxes_sandbox_id,
+ post_sandboxes,
+)
from e2b.connection_config import ConnectionConfig
from e2b.api import handle_api_exception
@@ -42,24 +49,32 @@ class SandboxApi:
)
with ApiClient(config) as api_client:
- try:
- return [
- SandboxInfo(
- sandbox_id=SandboxApi._get_sandbox_id(
- sandbox.sandbox_id,
- sandbox.client_id,
- ),
- template_id=sandbox.template_id,
- name=sandbox.alias,
- metadata=sandbox.metadata,
- started_at=sandbox.started_at,
- )
- for sandbox in client.SandboxesApi(api_client).sandboxes_get(
- _request_timeout=config.request_timeout,
- )
- ]
- except exceptions.ApiException as e:
- raise handle_api_exception(e)
+ res = get_sandboxes.sync_detailed(
+ client=api_client,
+ )
+
+ if res.status_code >= 300:
+ raise handle_api_exception(res)
+
+ if res.parsed is None:
+ return []
+
+ return [
+ SandboxInfo(
+ sandbox_id=SandboxApi._get_sandbox_id(
+ sandbox.sandbox_id,
+ sandbox.client_id,
+ ),
+ template_id=sandbox.template_id,
+ name=sandbox.alias if isinstance(sandbox.alias, str) else None,
+ metadata=(
+ sandbox.metadata if isinstance(sandbox.metadata, dict) else None
+ ),
+ started_at=sandbox.started_at,
+ )
+ for sandbox in res.parsed
+ if sandbox is not None
+ ]
@classmethod
def _cls_kill(
@@ -78,16 +93,18 @@ class SandboxApi:
)
with ApiClient(config) as api_client:
- try:
- client.SandboxesApi(api_client).sandboxes_sandbox_id_delete(
- sandbox_id,
- _request_timeout=config.request_timeout,
- )
- return True
- except exceptions.ApiException as e:
- if e.status == 404:
- return False
- raise handle_api_exception(e)
+ res = delete_sandboxes_sandbox_id.sync_detailed(
+ sandbox_id,
+ client=api_client,
+ )
+
+ if res.status_code == 404:
+ return False
+
+ if res.status_code >= 300:
+ raise handle_api_exception(res)
+
+ return True
@classmethod
def _cls_set_timeout(
@@ -107,21 +124,21 @@ class SandboxApi:
)
with ApiClient(config) as api_client:
- try:
- client.SandboxesApi(api_client).sandboxes_sandbox_id_timeout_post(
- sandbox_id,
- models.SandboxesSandboxIDTimeoutPostRequest(timeout=timeout),
- _request_timeout=config.request_timeout,
- )
- except exceptions.ApiException as e:
- raise handle_api_exception(e)
+ res = post_sandboxes_sandbox_id_timeout.sync_detailed(
+ sandbox_id,
+ client=api_client,
+ body=PostSandboxesSandboxIDTimeoutBody(timeout=timeout),
+ )
+
+ if res.status_code >= 300:
+ raise handle_api_exception(res)
@classmethod
def _create_sandbox(
cls,
template: str,
+ timeout: int,
metadata: Optional[Dict[str, str]] = None,
- timeout: Optional[int] = None,
api_key: Optional[str] = None,
domain: Optional[str] = None,
debug: Optional[bool] = None,
@@ -135,26 +152,37 @@ class SandboxApi:
)
with ApiClient(config) as api_client:
- try:
- res = client.SandboxesApi(api_client).sandboxes_post(
- models.NewSandbox(
- templateID=template,
- metadata=metadata,
- timeout=timeout,
- ),
- _request_timeout=config.request_timeout,
- )
- if Version(res.envd_version) < Version("0.1.0"):
- SandboxApi._cls_kill(
- SandboxApi._get_sandbox_id(res.sandbox_id, res.client_id)
- )
- raise TemplateException(
- "You need to update the template to use the new SDK. "
- "You can do this by running `e2b template build` in the directory with the template."
+ res = post_sandboxes.sync_detailed(
+ body=NewSandbox(
+ template_id=template,
+ metadata=metadata or {},
+ timeout=timeout,
+ ),
+ client=api_client,
+ )
+
+ if res.status_code >= 300:
+ raise handle_api_exception(res)
+
+ if res.parsed is None:
+ raise Exception("Body of the request is None")
+
+ if Version(res.parsed.envd_version) < Version("0.1.0"):
+ SandboxApi._cls_kill(
+ SandboxApi._get_sandbox_id(
+ res.parsed.sandbox_id,
+ res.parsed.client_id,
)
- return SandboxApi._get_sandbox_id(res.sandbox_id, res.client_id)
- except exceptions.ApiException as e:
- raise handle_api_exception(e)
+ )
+ raise TemplateException(
+ "You need to update the template to use the new SDK. "
+ "You can do this by running `e2b template build` in the directory with the template."
+ )
+
+ return SandboxApi._get_sandbox_id(
+ res.parsed.sandbox_id,
+ res.parsed.client_id,
+ )
@staticmethod
def _get_sandbox_id(sandbox_id: str, client_id: str) -> str:
diff --git a/packages/python-sdk/example.py b/packages/python-sdk/example.py
index c55f42557..7297e727e 100644
--- a/packages/python-sdk/example.py
+++ b/packages/python-sdk/example.py
@@ -1,6 +1,27 @@
+# from typing import Coroutine, Any
+
+import dotenv
+
+dotenv.load_dotenv()
+
from e2b import Sandbox
sbx = Sandbox()
+r = sbx.list()
+
+print(r)
+
+f = sbx.files.list("/")
+
+print(f)
+
+
+# sbx.files.list("/")
+
+
+# async def a():
+# return "a"
+
-sbx.files.list("/")
+# x = a()
diff --git a/packages/python-sdk/poetry.lock b/packages/python-sdk/poetry.lock
index 50b51c4e1..5ded889f9 100644
--- a/packages/python-sdk/poetry.lock
+++ b/packages/python-sdk/poetry.lock
@@ -1,31 +1,5 @@
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
-[[package]]
-name = "aenum"
-version = "3.1.15"
-description = "Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants"
-optional = false
-python-versions = "*"
-files = [
- {file = "aenum-3.1.15-py2-none-any.whl", hash = "sha256:27b1710b9d084de6e2e695dab78fe9f269de924b51ae2850170ee7e1ca6288a5"},
- {file = "aenum-3.1.15-py3-none-any.whl", hash = "sha256:e0dfaeea4c2bd362144b87377e2c61d91958c5ed0b4daf89cb6f45ae23af6288"},
- {file = "aenum-3.1.15.tar.gz", hash = "sha256:8cbd76cd18c4f870ff39b24284d3ea028fbe8731a58df3aa581e434c575b9559"},
-]
-
-[[package]]
-name = "annotated-types"
-version = "0.6.0"
-description = "Reusable constraint types to use with typing.Annotated"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "annotated_types-0.6.0-py3-none-any.whl", hash = "sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43"},
- {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"},
-]
-
-[package.dependencies]
-typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""}
-
[[package]]
name = "anyio"
version = "4.4.0"
@@ -48,6 +22,25 @@ doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphin
test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"]
trio = ["trio (>=0.23)"]
+[[package]]
+name = "attrs"
+version = "23.2.0"
+description = "Classes Without Boilerplate"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"},
+ {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"},
+]
+
+[package.extras]
+cov = ["attrs[tests]", "coverage[toml] (>=5.3)"]
+dev = ["attrs[tests]", "pre-commit"]
+docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"]
+tests = ["attrs[tests-no-zope]", "zope-interface"]
+tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"]
+tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"]
+
[[package]]
name = "black"
version = "23.12.1"
@@ -320,116 +313,6 @@ files = [
{file = "protobuf-5.26.1.tar.gz", hash = "sha256:8ca2a1d97c290ec7b16e4e5dff2e5ae150cc1582f55b5ab300d45cb0dfa90e51"},
]
-[[package]]
-name = "pydantic"
-version = "2.7.1"
-description = "Data validation using Python type hints"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "pydantic-2.7.1-py3-none-any.whl", hash = "sha256:e029badca45266732a9a79898a15ae2e8b14840b1eabbb25844be28f0b33f3d5"},
- {file = "pydantic-2.7.1.tar.gz", hash = "sha256:e9dbb5eada8abe4d9ae5f46b9939aead650cd2b68f249bb3a8139dbe125803cc"},
-]
-
-[package.dependencies]
-annotated-types = ">=0.4.0"
-pydantic-core = "2.18.2"
-typing-extensions = ">=4.6.1"
-
-[package.extras]
-email = ["email-validator (>=2.0.0)"]
-
-[[package]]
-name = "pydantic-core"
-version = "2.18.2"
-description = "Core functionality for Pydantic validation and serialization"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "pydantic_core-2.18.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:9e08e867b306f525802df7cd16c44ff5ebbe747ff0ca6cf3fde7f36c05a59a81"},
- {file = "pydantic_core-2.18.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f0a21cbaa69900cbe1a2e7cad2aa74ac3cf21b10c3efb0fa0b80305274c0e8a2"},
- {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0680b1f1f11fda801397de52c36ce38ef1c1dc841a0927a94f226dea29c3ae3d"},
- {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:95b9d5e72481d3780ba3442eac863eae92ae43a5f3adb5b4d0a1de89d42bb250"},
- {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4fcf5cd9c4b655ad666ca332b9a081112cd7a58a8b5a6ca7a3104bc950f2038"},
- {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b5155ff768083cb1d62f3e143b49a8a3432e6789a3abee8acd005c3c7af1c74"},
- {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:553ef617b6836fc7e4df130bb851e32fe357ce36336d897fd6646d6058d980af"},
- {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b89ed9eb7d616ef5714e5590e6cf7f23b02d0d539767d33561e3675d6f9e3857"},
- {file = "pydantic_core-2.18.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:75f7e9488238e920ab6204399ded280dc4c307d034f3924cd7f90a38b1829563"},
- {file = "pydantic_core-2.18.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ef26c9e94a8c04a1b2924149a9cb081836913818e55681722d7f29af88fe7b38"},
- {file = "pydantic_core-2.18.2-cp310-none-win32.whl", hash = "sha256:182245ff6b0039e82b6bb585ed55a64d7c81c560715d1bad0cbad6dfa07b4027"},
- {file = "pydantic_core-2.18.2-cp310-none-win_amd64.whl", hash = "sha256:e23ec367a948b6d812301afc1b13f8094ab7b2c280af66ef450efc357d2ae543"},
- {file = "pydantic_core-2.18.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:219da3f096d50a157f33645a1cf31c0ad1fe829a92181dd1311022f986e5fbe3"},
- {file = "pydantic_core-2.18.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:cc1cfd88a64e012b74e94cd00bbe0f9c6df57049c97f02bb07d39e9c852e19a4"},
- {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:05b7133a6e6aeb8df37d6f413f7705a37ab4031597f64ab56384c94d98fa0e90"},
- {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:224c421235f6102e8737032483f43c1a8cfb1d2f45740c44166219599358c2cd"},
- {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b14d82cdb934e99dda6d9d60dc84a24379820176cc4a0d123f88df319ae9c150"},
- {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2728b01246a3bba6de144f9e3115b532ee44bd6cf39795194fb75491824a1413"},
- {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:470b94480bb5ee929f5acba6995251ada5e059a5ef3e0dfc63cca287283ebfa6"},
- {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:997abc4df705d1295a42f95b4eec4950a37ad8ae46d913caeee117b6b198811c"},
- {file = "pydantic_core-2.18.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:75250dbc5290e3f1a0f4618db35e51a165186f9034eff158f3d490b3fed9f8a0"},
- {file = "pydantic_core-2.18.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:4456f2dca97c425231d7315737d45239b2b51a50dc2b6f0c2bb181fce6207664"},
- {file = "pydantic_core-2.18.2-cp311-none-win32.whl", hash = "sha256:269322dcc3d8bdb69f054681edff86276b2ff972447863cf34c8b860f5188e2e"},
- {file = "pydantic_core-2.18.2-cp311-none-win_amd64.whl", hash = "sha256:800d60565aec896f25bc3cfa56d2277d52d5182af08162f7954f938c06dc4ee3"},
- {file = "pydantic_core-2.18.2-cp311-none-win_arm64.whl", hash = "sha256:1404c69d6a676245199767ba4f633cce5f4ad4181f9d0ccb0577e1f66cf4c46d"},
- {file = "pydantic_core-2.18.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:fb2bd7be70c0fe4dfd32c951bc813d9fe6ebcbfdd15a07527796c8204bd36242"},
- {file = "pydantic_core-2.18.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6132dd3bd52838acddca05a72aafb6eab6536aa145e923bb50f45e78b7251043"},
- {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7d904828195733c183d20a54230c0df0eb46ec746ea1a666730787353e87182"},
- {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c9bd70772c720142be1020eac55f8143a34ec9f82d75a8e7a07852023e46617f"},
- {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2b8ed04b3582771764538f7ee7001b02e1170223cf9b75dff0bc698fadb00cf3"},
- {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e6dac87ddb34aaec85f873d737e9d06a3555a1cc1a8e0c44b7f8d5daeb89d86f"},
- {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ca4ae5a27ad7a4ee5170aebce1574b375de390bc01284f87b18d43a3984df72"},
- {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:886eec03591b7cf058467a70a87733b35f44707bd86cf64a615584fd72488b7c"},
- {file = "pydantic_core-2.18.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ca7b0c1f1c983e064caa85f3792dd2fe3526b3505378874afa84baf662e12241"},
- {file = "pydantic_core-2.18.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4b4356d3538c3649337df4074e81b85f0616b79731fe22dd11b99499b2ebbdf3"},
- {file = "pydantic_core-2.18.2-cp312-none-win32.whl", hash = "sha256:8b172601454f2d7701121bbec3425dd71efcb787a027edf49724c9cefc14c038"},
- {file = "pydantic_core-2.18.2-cp312-none-win_amd64.whl", hash = "sha256:b1bd7e47b1558ea872bd16c8502c414f9e90dcf12f1395129d7bb42a09a95438"},
- {file = "pydantic_core-2.18.2-cp312-none-win_arm64.whl", hash = "sha256:98758d627ff397e752bc339272c14c98199c613f922d4a384ddc07526c86a2ec"},
- {file = "pydantic_core-2.18.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:9fdad8e35f278b2c3eb77cbdc5c0a49dada440657bf738d6905ce106dc1de439"},
- {file = "pydantic_core-2.18.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1d90c3265ae107f91a4f279f4d6f6f1d4907ac76c6868b27dc7fb33688cfb347"},
- {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:390193c770399861d8df9670fb0d1874f330c79caaca4642332df7c682bf6b91"},
- {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:82d5d4d78e4448683cb467897fe24e2b74bb7b973a541ea1dcfec1d3cbce39fb"},
- {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4774f3184d2ef3e14e8693194f661dea5a4d6ca4e3dc8e39786d33a94865cefd"},
- {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d4d938ec0adf5167cb335acb25a4ee69a8107e4984f8fbd2e897021d9e4ca21b"},
- {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0e8b1be28239fc64a88a8189d1df7fad8be8c1ae47fcc33e43d4be15f99cc70"},
- {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:868649da93e5a3d5eacc2b5b3b9235c98ccdbfd443832f31e075f54419e1b96b"},
- {file = "pydantic_core-2.18.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:78363590ef93d5d226ba21a90a03ea89a20738ee5b7da83d771d283fd8a56761"},
- {file = "pydantic_core-2.18.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:852e966fbd035a6468fc0a3496589b45e2208ec7ca95c26470a54daed82a0788"},
- {file = "pydantic_core-2.18.2-cp38-none-win32.whl", hash = "sha256:6a46e22a707e7ad4484ac9ee9f290f9d501df45954184e23fc29408dfad61350"},
- {file = "pydantic_core-2.18.2-cp38-none-win_amd64.whl", hash = "sha256:d91cb5ea8b11607cc757675051f61b3d93f15eca3cefb3e6c704a5d6e8440f4e"},
- {file = "pydantic_core-2.18.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:ae0a8a797a5e56c053610fa7be147993fe50960fa43609ff2a9552b0e07013e8"},
- {file = "pydantic_core-2.18.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:042473b6280246b1dbf530559246f6842b56119c2926d1e52b631bdc46075f2a"},
- {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a388a77e629b9ec814c1b1e6b3b595fe521d2cdc625fcca26fbc2d44c816804"},
- {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e25add29b8f3b233ae90ccef2d902d0ae0432eb0d45370fe315d1a5cf231004b"},
- {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f459a5ce8434614dfd39bbebf1041952ae01da6bed9855008cb33b875cb024c0"},
- {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eff2de745698eb46eeb51193a9f41d67d834d50e424aef27df2fcdee1b153845"},
- {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a8309f67285bdfe65c372ea3722b7a5642680f3dba538566340a9d36e920b5f0"},
- {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f93a8a2e3938ff656a7c1bc57193b1319960ac015b6e87d76c76bf14fe0244b4"},
- {file = "pydantic_core-2.18.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:22057013c8c1e272eb8d0eebc796701167d8377441ec894a8fed1af64a0bf399"},
- {file = "pydantic_core-2.18.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:cfeecd1ac6cc1fb2692c3d5110781c965aabd4ec5d32799773ca7b1456ac636b"},
- {file = "pydantic_core-2.18.2-cp39-none-win32.whl", hash = "sha256:0d69b4c2f6bb3e130dba60d34c0845ba31b69babdd3f78f7c0c8fae5021a253e"},
- {file = "pydantic_core-2.18.2-cp39-none-win_amd64.whl", hash = "sha256:d9319e499827271b09b4e411905b24a426b8fb69464dfa1696258f53a3334641"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:a1874c6dd4113308bd0eb568418e6114b252afe44319ead2b4081e9b9521fe75"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:ccdd111c03bfd3666bd2472b674c6899550e09e9f298954cfc896ab92b5b0e6d"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e18609ceaa6eed63753037fc06ebb16041d17d28199ae5aba0052c51449650a9"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e5c584d357c4e2baf0ff7baf44f4994be121e16a2c88918a5817331fc7599d7"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43f0f463cf89ace478de71a318b1b4f05ebc456a9b9300d027b4b57c1a2064fb"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:e1b395e58b10b73b07b7cf740d728dd4ff9365ac46c18751bf8b3d8cca8f625a"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:0098300eebb1c837271d3d1a2cd2911e7c11b396eac9661655ee524a7f10587b"},
- {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:36789b70d613fbac0a25bb07ab3d9dba4d2e38af609c020cf4d888d165ee0bf3"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3f9a801e7c8f1ef8718da265bba008fa121243dfe37c1cea17840b0944dfd72c"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:3a6515ebc6e69d85502b4951d89131ca4e036078ea35533bb76327f8424531ce"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:20aca1e2298c56ececfd8ed159ae4dde2df0781988c97ef77d5c16ff4bd5b400"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:223ee893d77a310a0391dca6df00f70bbc2f36a71a895cecd9a0e762dc37b349"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2334ce8c673ee93a1d6a65bd90327588387ba073c17e61bf19b4fd97d688d63c"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:cbca948f2d14b09d20268cda7b0367723d79063f26c4ffc523af9042cad95592"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:b3ef08e20ec49e02d5c6717a91bb5af9b20f1805583cb0adfe9ba2c6b505b5ae"},
- {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:c6fdc8627910eed0c01aed6a390a252fe3ea6d472ee70fdde56273f198938374"},
- {file = "pydantic_core-2.18.2.tar.gz", hash = "sha256:2e29d20810dfc3043ee13ac7d9e25105799817683348823f305ab3f349b9386e"},
-]
-
-[package.dependencies]
-typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"
-
[[package]]
name = "pytest"
version = "7.4.4"
@@ -550,33 +433,16 @@ files = [
[[package]]
name = "typing-extensions"
-version = "4.11.0"
+version = "4.12.2"
description = "Backported and Experimental Type Hints for Python 3.8+"
optional = false
python-versions = ">=3.8"
files = [
- {file = "typing_extensions-4.11.0-py3-none-any.whl", hash = "sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a"},
- {file = "typing_extensions-4.11.0.tar.gz", hash = "sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0"},
-]
-
-[[package]]
-name = "urllib3"
-version = "2.2.1"
-description = "HTTP library with thread-safe connection pooling, file post, and more."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"},
- {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"},
+ {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"},
+ {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"},
]
-[package.extras]
-brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"]
-h2 = ["h2 (>=4,<5)"]
-socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
-zstd = ["zstandard (>=0.18.0)"]
-
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
-content-hash = "011f5a00fd1d5cb161867bf2f22d1fd90bb070bd9c11851afcb5b159f251e930"
+content-hash = "e0bad63042465728305d56fa013c5e7c9c207e6d1f31630d1c137c4456ae20a6"
diff --git a/packages/python-sdk/pyproject.toml b/packages/python-sdk/pyproject.toml
index 5664d76f3..6e4034244 100644
--- a/packages/python-sdk/pyproject.toml
+++ b/packages/python-sdk/pyproject.toml
@@ -12,14 +12,11 @@ packages = [{ include = "e2b" }, { include = "connect" }]
[tool.poetry.dependencies]
python = "^3.8"
-urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
-pydantic = "*"
-aenum = ">=3.1.11"
-typing-extensions = ">=4.8.0"
protobuf = "^5.26.1"
httpcore = "^1.0.5"
httpx = "^0.27.0"
+attrs = "^23.2.0"
[tool.poetry.group.dev.dependencies]
black = "^23.7.0"