Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Update openapi generator
Jakub Novak241f1e432972
diff --git a/packages/python-sdk/Makefile b/packages/python-sdk/Makefileindex c21cc984e..a5f546300 100644--- a/packages/python-sdk/Makefile+++ b/packages/python-sdk/Makefile@@ -2,10 +2,8 @@generate-v2:mv ./e2b/api/__init__.py ./e2b/api/__init__.py.bckrm -rf ./e2b/api/v2- # Waiting for https://github.com/OpenAPITools/openapi-generator/pull/16655 to be merged- # Using this branch to use pydantic v2: https://github.com/fa0311/openapi-generator/tree/oshmoun-master-2- # After released, use npx -yes @openapitools/openapi-generator-cli generate- java -jar ~/Work/e2b/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \+ 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 \@@ -26,9 +24,10 @@ generate-v2:generate-v1:mv ./e2b/api/__init__.py ./e2b/api/__init__.py.bckrm -rf ./e2b/api/v1- npx -yes @openapitools/openapi-generator-cli generate \+ 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-nextgen \+ -g python-pydantic-v1 \-o ./e2b/api \--global-property apis="instances",models,supportingFiles,modelDocs=false \--additional-properties=generateSourceCodeOnly=true \diff --git a/packages/python-sdk/e2b/api/__init__.py b/packages/python-sdk/e2b/api/__init__.pyindex 761713b0c..fbf4c45e1 100644--- a/packages/python-sdk/e2b/api/__init__.py+++ b/packages/python-sdk/e2b/api/__init__.py@@ -6,6 +6,7 @@ from e2b.api.metadata import default_headerspydantic_version = version("pydantic")+print(pydantic_version)if pydantic_version < "2.0.0":import e2b.api.v1.client as clientimport e2b.api.v1.client.models as modelsdiff --git a/packages/python-sdk/e2b/api/v1/client/__init__.py b/packages/python-sdk/e2b/api/v1/client/__init__.pyindex a40c76036..610e524bb 100644--- a/packages/python-sdk/e2b/api/v1/client/__init__.py+++ b/packages/python-sdk/e2b/api/v1/client/__init__.py@@ -5,13 +5,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501__version__ = "1.0.0"@@ -36,7 +36,6 @@ from e2b.api.v1.client.models.environment_build import EnvironmentBuildfrom e2b.api.v1.client.models.envs_env_id_builds_build_id_logs_post_request import (EnvsEnvIDBuildsBuildIDLogsPostRequest,)-from e2b.api.v1.client.models.envs_get200_response_inner import EnvsGet200ResponseInnerfrom e2b.api.v1.client.models.error import Errorfrom e2b.api.v1.client.models.instance import Instancefrom e2b.api.v1.client.models.instances_instance_id_refreshes_post_request import (diff --git a/packages/python-sdk/e2b/api/v1/client/api/instances_api.py b/packages/python-sdk/e2b/api/v1/client/api/instances_api.pyindex c23b67f22..3f44d7764 100644--- a/packages/python-sdk/e2b/api/v1/client/api/instances_api.py+++ b/packages/python-sdk/e2b/api/v1/client/api/instances_api.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501import re # noqa: F401@@ -17,7 +17,6 @@ import ioimport warningsfrom pydantic import validate_arguments, ValidationError-from typing_extensions import Annotatedfrom pydantic import StrictStr@@ -34,14 +33,14 @@ from e2b.api.v1.client.api_response import ApiResponsefrom e2b.api.v1.client.exceptions import ApiTypeError, ApiValueError # noqa: F401-class InstancesApi(object):+class InstancesApi:"""NOTE: This class is auto generated by OpenAPI GeneratorRef: https://openapi-generator.techDo not edit the class manually."""- def __init__(self, api_client=None):+ def __init__(self, api_client=None) -> None:if api_client is None:api_client = ApiClient.get_default()self.api_client = api_client@@ -70,10 +69,10 @@ class InstancesApi(object)::type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest: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.+ :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.@@ -81,9 +80,8 @@ class InstancesApi(object):"""kwargs["_return_http_data_only"] = Trueif "_preload_content" in kwargs:- raise ValueError(- "Error! Please call the instances_instance_id_refreshes_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"- )+ message = "Error! Please call the instances_instance_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.instances_instance_id_refreshes_post_with_http_info(instance_id, instances_instance_id_refreshes_post_request, **kwargs) # noqa: E501@@ -164,7 +162,7 @@ class InstancesApi(object):# process the path parameters_path_params = {}- if _params["instance_id"]:+ if _params["instance_id"] is not None:_path_params["instanceID"] = _params["instance_id"]# process the query parameters@@ -233,10 +231,10 @@ class InstancesApi(object)::type new_instance: NewInstance: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.+ :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.@@ -244,9 +242,8 @@ class InstancesApi(object):"""kwargs["_return_http_data_only"] = Trueif "_preload_content" in kwargs:- raise ValueError(- "Error! Please call the instances_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"- )+ message = "Error! Please call the instances_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501+ raise ValueError(message)return self.instances_post_with_http_info(new_instance, **kwargs) # noqa: E501@validate_argumentsdiff --git a/packages/python-sdk/e2b/api/v1/client/api_client.py b/packages/python-sdk/e2b/api/v1/client/api_client.pyindex c2697b3c6..2ee64b21d 100644--- a/packages/python-sdk/e2b/api/v1/client/api_client.py+++ b/packages/python-sdk/e2b/api/v1/client/api_client.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501import atexit@@ -31,7 +31,7 @@ from e2b.api.v1.client import restfrom e2b.api.v1.client.exceptions import ApiValueError, ApiException-class ApiClient(object):+class ApiClient:"""Generic API client for OpenAPI client library builds.OpenAPI generic API client. This client handles the client-@@ -69,7 +69,7 @@ class ApiClient(object):header_value=None,cookie=None,pool_threads=1,- ):+ ) -> None:# use default configuration if none is providedif configuration is None:configuration = Configuration.get_default()@@ -243,10 +243,19 @@ class ApiClient(object):self.last_response = response_data- return_data = None # assuming derialization is not needed+ return_data = None # assuming deserialization is not needed# data needs deserialization or returns HTTP data (deserialized) onlyif _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@@ -348,7 +357,7 @@ class ApiClient(object):if data is None:return None- if type(klass) == str:+ 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]@@ -435,47 +444,28 @@ class ApiClient(object):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(- 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,- )+ return self.__call_api(*args)- return self.pool.apply_async(- self.__call_api,- (- 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,- ),- )+ return self.pool.apply_async(self.__call_api, args)def request(self,@@ -602,10 +592,10 @@ class ApiClient(object):for k, v in (params.items() if isinstance(params, dict) else params): # noqa: E501- if isinstance(v, (int, float)):- v = str(v)if isinstance(v, bool):v = str(v).lower()+ if isinstance(v, (int, float)):+ v = str(v)if isinstance(v, dict):v = json.dumps(v)diff --git a/packages/python-sdk/e2b/api/v1/client/api_response.py b/packages/python-sdk/e2b/api/v1/client/api_response.pyindex 0af0a2dd5..bb7e40032 100644--- a/packages/python-sdk/e2b/api/v1/client/api_response.py+++ b/packages/python-sdk/e2b/api/v1/client/api_response.py@@ -19,7 +19,9 @@ class ApiResponse:)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):+ def __init__(+ self, status_code=None, headers=None, data=None, raw_data=None+ ) -> None:self.status_code = status_codeself.headers = headersself.data = datadiff --git a/packages/python-sdk/e2b/api/v1/client/configuration.py b/packages/python-sdk/e2b/api/v1/client/configuration.pyindex 20fc20e66..49efca49a 100644--- a/packages/python-sdk/e2b/api/v1/client/configuration.py+++ b/packages/python-sdk/e2b/api/v1/client/configuration.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501import copy@@ -19,7 +19,6 @@ import sysimport urllib3import http.client as httplib-from e2b.api.v1.client.exceptions import ApiValueErrorJSON_SCHEMA_VALIDATION_KEYWORDS = {"multipleOf",@@ -35,7 +34,7 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {}-class Configuration(object):+class Configuration:"""This class contains various settings of the API client.:param host: Base url.@@ -57,7 +56,8 @@ class Configuration(object):configuration.:param server_operation_variables: Mapping from operation ID to a mapping withstring values to replace variables in templated server configuration.- The validation of enums is performed for variables with defined enum values before.+ 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 certificatesin PEM format.@@ -98,7 +98,7 @@ class Configuration(object):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@@ -137,9 +137,6 @@ class Configuration(object):self.access_token = access_token"""Access token"""- self.access_token = None- """access token for OAuth/Bearer- """self.logger = {}"""Logging Settings"""diff --git a/packages/python-sdk/e2b/api/v1/client/exceptions.py b/packages/python-sdk/e2b/api/v1/client/exceptions.pyindex adb1ca56c..5a56914c5 100644--- a/packages/python-sdk/e2b/api/v1/client/exceptions.py+++ b/packages/python-sdk/e2b/api/v1/client/exceptions.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501class OpenApiException(Exception):@@ -17,7 +17,9 @@ class OpenApiException(Exception):class ApiTypeError(OpenApiException, TypeError):- def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None):+ def __init__(+ self, msg, path_to_item=None, valid_classes=None, key_type=None+ ) -> None:"""Raises an exception for TypeErrorsArgs:@@ -45,7 +47,7 @@ class ApiTypeError(OpenApiException, TypeError):class ApiValueError(OpenApiException, ValueError):- def __init__(self, msg, path_to_item=None):+ def __init__(self, msg, path_to_item=None) -> None:"""Args:msg (str): the exception message@@ -63,7 +65,7 @@ class ApiValueError(OpenApiException, ValueError):class ApiAttributeError(OpenApiException, AttributeError):- def __init__(self, msg, path_to_item=None):+ def __init__(self, msg, path_to_item=None) -> None:"""Raised when an attribute reference or assignment fails.@@ -82,7 +84,7 @@ class ApiAttributeError(OpenApiException, AttributeError):class ApiKeyError(OpenApiException, KeyError):- def __init__(self, msg, path_to_item=None):+ def __init__(self, msg, path_to_item=None) -> None:"""Args:msg (str): the exception message@@ -99,7 +101,7 @@ class ApiKeyError(OpenApiException, KeyError):class ApiException(OpenApiException):- def __init__(self, status=None, reason=None, http_resp=None):+ def __init__(self, status=None, reason=None, http_resp=None) -> None:if http_resp:self.status = http_resp.statusself.reason = http_resp.reason@@ -123,23 +125,28 @@ class ApiException(OpenApiException):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):+ 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):+ 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):+ 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):+ def __init__(self, status=None, reason=None, http_resp=None) -> None:super(ServiceException, self).__init__(status, reason, http_resp)diff --git a/packages/python-sdk/e2b/api/v1/client/models/__init__.py b/packages/python-sdk/e2b/api/v1/client/models/__init__.pyindex 7b14455ec..fecd4eaa6 100644--- a/packages/python-sdk/e2b/api/v1/client/models/__init__.py+++ b/packages/python-sdk/e2b/api/v1/client/models/__init__.py@@ -4,13 +4,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501# import models into model package@@ -19,7 +19,6 @@ from e2b.api.v1.client.models.environment_build import EnvironmentBuildfrom e2b.api.v1.client.models.envs_env_id_builds_build_id_logs_post_request import (EnvsEnvIDBuildsBuildIDLogsPostRequest,)-from e2b.api.v1.client.models.envs_get200_response_inner import EnvsGet200ResponseInnerfrom e2b.api.v1.client.models.error import Errorfrom e2b.api.v1.client.models.instance import Instancefrom e2b.api.v1.client.models.instances_instance_id_refreshes_post_request import (diff --git a/packages/python-sdk/e2b/api/v1/client/models/environment.py b/packages/python-sdk/e2b/api/v1/client/models/environment.pyindex 1de9a86c7..8abad3fa2 100644--- a/packages/python-sdk/e2b/api/v1/client/models/environment.py+++ b/packages/python-sdk/e2b/api/v1/client/models/environment.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotationsdiff --git a/packages/python-sdk/e2b/api/v1/client/models/environment_build.py b/packages/python-sdk/e2b/api/v1/client/models/environment_build.pyindex 9e59af76c..93a69b9b4 100644--- a/packages/python-sdk/e2b/api/v1/client/models/environment_build.py+++ b/packages/python-sdk/e2b/api/v1/client/models/environment_build.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotationsdiff --git a/packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.py b/packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.pyindex 866998bda..df7e5b3da 100644--- a/packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.py+++ b/packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotationsdiff --git a/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.py b/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.pydeleted file mode 100644index 6d802ccbf..000000000--- a/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.py+++ /dev/null@@ -1,96 +0,0 @@-# coding: utf-8--"""- E2B API-- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501-- The version of the OpenAPI document: 0.1.0- Generated by OpenAPI Generator (https://openapi-generator.tech)-- Do not edit the class manually.-"""---from __future__ import annotations-import pprint-import re # noqa: F401-import json---from typing import List, Optional-from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist---class EnvsGet200ResponseInner(BaseModel):- """- EnvsGet200ResponseInner- """-- env_id: StrictStr = Field(- ..., alias="envID", description="Identifier of the environment"- )- build_id: StrictStr = Field(- ...,- alias="buildID",- description="Identifier of the last successful build for given environment",- )- public: StrictBool = Field(- ...,- description="Whether the environment is public or only accessible by the team",- )- aliases: Optional[conlist(StrictStr)] = Field(- None, description="Aliases of the environment"- )- __properties = ["envID", "buildID", "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) -> EnvsGet200ResponseInner:- """Create an instance of EnvsGet200ResponseInner 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={}, exclude_none=True)- return _dict-- @classmethod- def from_dict(cls, obj: dict) -> EnvsGet200ResponseInner:- """Create an instance of EnvsGet200ResponseInner from a dict"""- if obj is None:- return None-- if not isinstance(obj, dict):- return EnvsGet200ResponseInner.parse_obj(obj)-- # raise errors for additional fields in the input- for _key in obj.keys():- if _key not in cls.__properties:- raise ValueError(- "Error due to additional fields (not defined in EnvsGet200ResponseInner) in the input: "- + obj- )-- _obj = EnvsGet200ResponseInner.parse_obj(- {- "env_id": obj.get("envID"),- "build_id": obj.get("buildID"),- "public": obj.get("public"),- "aliases": obj.get("aliases"),- }- )- return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/error.py b/packages/python-sdk/e2b/api/v1/client/models/error.pyindex 6c960a15d..108c09ed0 100644--- a/packages/python-sdk/e2b/api/v1/client/models/error.py+++ b/packages/python-sdk/e2b/api/v1/client/models/error.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotationsdiff --git a/packages/python-sdk/e2b/api/v1/client/models/instance.py b/packages/python-sdk/e2b/api/v1/client/models/instance.pyindex a9ba943d9..187481472 100644--- a/packages/python-sdk/e2b/api/v1/client/models/instance.py+++ b/packages/python-sdk/e2b/api/v1/client/models/instance.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotationsdiff --git a/packages/python-sdk/e2b/api/v1/client/models/instances_instance_id_refreshes_post_request.py b/packages/python-sdk/e2b/api/v1/client/models/instances_instance_id_refreshes_post_request.pyindex d95e43c78..46c057787 100644--- a/packages/python-sdk/e2b/api/v1/client/models/instances_instance_id_refreshes_post_request.py+++ b/packages/python-sdk/e2b/api/v1/client/models/instances_instance_id_refreshes_post_request.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotations@@ -18,6 +18,7 @@ import re # noqa: F401import json+from typing import Optionalfrom pydantic import BaseModel, Field, conint@@ -26,8 +27,8 @@ class InstancesInstanceIDRefreshesPostRequest(BaseModel):InstancesInstanceIDRefreshesPostRequest"""- duration: conint(strict=True, le=3600, ge=0) = Field(- ...,+ duration: Optional[conint(strict=True, le=3600, ge=0)] = Field(+ None,description="Duration for which the instance should be kept alive in seconds",)__properties = ["duration"]diff --git a/packages/python-sdk/e2b/api/v1/client/models/new_instance.py b/packages/python-sdk/e2b/api/v1/client/models/new_instance.pyindex e9d06ff37..f72bc5bd3 100644--- a/packages/python-sdk/e2b/api/v1/client/models/new_instance.py+++ b/packages/python-sdk/e2b/api/v1/client/models/new_instance.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501from __future__ import annotationsdiff --git a/packages/python-sdk/e2b/api/v1/client/rest.py b/packages/python-sdk/e2b/api/v1/client/rest.pyindex e9823f106..b7be37ee4 100644--- a/packages/python-sdk/e2b/api/v1/client/rest.py+++ b/packages/python-sdk/e2b/api/v1/client/rest.py@@ -3,13 +3,13 @@"""E2B API- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)The version of the OpenAPI document: 0.1.0Generated by OpenAPI Generator (https://openapi-generator.tech)Do not edit the class manually.-"""+""" # noqa: E501import io@@ -28,6 +28,7 @@ from e2b.api.v1.client.exceptions import (NotFoundException,ServiceException,ApiValueError,+ BadRequestException,)@@ -35,7 +36,7 @@ logger = logging.getLogger(__name__)class RESTResponse(io.IOBase):- def __init__(self, resp):+ def __init__(self, resp) -> None:self.urllib3_response = respself.status = resp.statusself.reason = resp.reason@@ -50,8 +51,8 @@ class RESTResponse(io.IOBase):return self.urllib3_response.headers.get(name, default)-class RESTClientObject(object):- def __init__(self, configuration, pools_size=4, maxsize=None):+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@@ -245,6 +246,9 @@ class RESTClientObject(object):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)diff --git a/packages/python-sdk/e2b/api/v1/client_README.md b/packages/python-sdk/e2b/api/v1/client_README.mdindex 62b0b8973..752193f18 100644--- a/packages/python-sdk/e2b/api/v1/client_README.md+++ b/packages/python-sdk/e2b/api/v1/client_README.md@@ -5,7 +5,7 @@ The `e2b.api.v1.client` package is automatically generated by the [OpenAPI Gener- API version: 0.1.0- Package version: 1.0.0-- Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen+- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen## Requirements.@@ -81,7 +81,6 @@ Class | Method | HTTP request | Description- [Environment](e2b/api/v1/client/docs/Environment.md)- [EnvironmentBuild](e2b/api/v1/client/docs/EnvironmentBuild.md)- [EnvsEnvIDBuildsBuildIDLogsPostRequest](e2b/api/v1/client/docs/EnvsEnvIDBuildsBuildIDLogsPostRequest.md)- - [EnvsGet200ResponseInner](e2b/api/v1/client/docs/EnvsGet200ResponseInner.md)- [Error](e2b/api/v1/client/docs/Error.md)- [Instance](e2b/api/v1/client/docs/Instance.md)- [InstancesInstanceIDRefreshesPostRequest](e2b/api/v1/client/docs/InstancesInstanceIDRefreshesPostRequest.md)diff --git a/packages/python-sdk/e2b/api/v2/client/api/instances_api.py b/packages/python-sdk/e2b/api/v2/client/api/instances_api.pyindex b4e2cea50..ed7ddf1a1 100644--- a/packages/python-sdk/e2b/api/v2/client/api/instances_api.py+++ b/packages/python-sdk/e2b/api/v2/client/api/instances_api.py@@ -12,12 +12,16 @@""" # noqa: E501-import re # noqa: F401import ioimport warnings-from pydantic import validate_call, ValidationError-from typing_extensions import Annotated+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 Annotatedfrom pydantic import StrictStr@@ -31,7 +35,7 @@ from e2b.api.v2.client.models.new_instance import NewInstancefrom e2b.api.v2.client.api_client import ApiClientfrom e2b.api.v2.client.api_response import ApiResponse-from e2b.api.v2.client.exceptions import ApiTypeError, ApiValueError # noqa: F401+from e2b.api.v2.client.rest import RESTResponseTypeclass InstancesApi:@@ -53,39 +57,66 @@ class InstancesApi:instances_instance_id_refreshes_post_request: Optional[InstancesInstanceIDRefreshesPostRequest] = None,- **kwargs- ) -> None: # noqa: E501- """instances_instance_id_refreshes_post # noqa: E501-- Refresh the instance 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+ _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:+ """instances_instance_id_refreshes_post- >>> thread = api.instances_instance_id_refreshes_post(instance_id, instances_instance_id_refreshes_post_request, async_req=True)- >>> result = thread.get()+ Refresh the instance extending its time to live:param instance_id: (required):type instance_id: str:param instances_instance_id_refreshes_post_request::type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest- :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.+ :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.- 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 instances_instance_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.instances_instance_id_refreshes_post_with_http_info(- instance_id, instances_instance_id_refreshes_post_request, **kwargs- ) # noqa: E501+ """ # noqa: E501++ _param = self._instances_instance_id_refreshes_post_serialize(+ instance_id=instance_id,+ instances_instance_id_refreshes_post_request=instances_instance_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_calldef instances_instance_id_refreshes_post_with_http_info(@@ -94,279 +125,447 @@ class InstancesApi:instances_instance_id_refreshes_post_request: Optional[InstancesInstanceIDRefreshesPostRequest] = None,- **kwargs- ) -> ApiResponse: # noqa: E501- """instances_instance_id_refreshes_post # noqa: E501+ _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]:+ """instances_instance_id_refreshes_post- Refresh the instance 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+ Refresh the instance extending its time to live- >>> thread = api.instances_instance_id_refreshes_post_with_http_info(instance_id, instances_instance_id_refreshes_post_request, async_req=True)- >>> result = thread.get()+ :param instance_id: (required)+ :type instance_id: str+ :param instances_instance_id_refreshes_post_request:+ :type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest+ :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._instances_instance_id_refreshes_post_serialize(+ instance_id=instance_id,+ instances_instance_id_refreshes_post_request=instances_instance_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 instances_instance_id_refreshes_post_without_preload_content(+ self,+ instance_id: StrictStr,+ instances_instance_id_refreshes_post_request: Optional[+ InstancesInstanceIDRefreshesPostRequest+ ] = 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:+ """instances_instance_id_refreshes_post++ Refresh the instance extending its time to live:param instance_id: (required):type instance_id: str:param instances_instance_id_refreshes_post_request::type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest- :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 onenumber provided, it will be total requesttimeout. 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.+ 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+ :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.- If the method is called asynchronously,- returns the request thread.- :rtype: None- """-- _params = locals()-- _all_params = ["instance_id", "instances_instance_id_refreshes_post_request"]- _all_params.extend(- [- "async_req",- "_return_http_data_only",- "_preload_content",- "_request_timeout",- "_request_auth",- "_content_type",- "_headers",- ]+ """ # noqa: E501++ _param = self._instances_instance_id_refreshes_post_serialize(+ instance_id=instance_id,+ instances_instance_id_refreshes_post_request=instances_instance_id_refreshes_post_request,+ _request_auth=_request_auth,+ _content_type=_content_type,+ _headers=_headers,+ _host_index=_host_index,)- # 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 instances_instance_id_refreshes_post" % _key- )- _params[_key] = _val- del _params["kwargs"]+ _response_types_map: Dict[str, Optional[str]] = {}+ response_data = self.api_client.call_api(+ *_param, _request_timeout=_request_timeout+ )+ return response_data.response- _collection_formats = {}+ def _instances_instance_id_refreshes_post_serialize(+ self,+ instance_id,+ instances_instance_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- _path_params = {}- if _params["instance_id"]:- _path_params["instanceID"] = _params["instance_id"]-+ if instance_id is not None:+ _path_params["instanceID"] = instance_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["instances_instance_id_refreshes_post_request"] is not None:- _body_params = _params["instances_instance_id_refreshes_post_request"]+ if instances_instance_id_refreshes_post_request is not None:+ _body_params = instances_instance_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+ 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 = ["ApiKeyAuth"] # noqa: E501-- _response_types_map = {}-- return self.api_client.call_api(- "/instances/{instanceID}/refreshes",- "POST",- _path_params,- _query_params,- _header_params,+ _auth_settings: List[str] = ["ApiKeyAuth"]++ return self.api_client.param_serialize(+ method="POST",+ resource_path="/instances/{instanceID}/refreshes",+ path_params=_path_params,+ query_params=_query_params,+ header_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"),+ _host=_host,+ _request_auth=_request_auth,)@validate_calldef instances_post(- self, new_instance: NewInstance, **kwargs- ) -> Instance: # noqa: E501- """instances_post # noqa: E501-- Create an instance from the environment # noqa: E501- This method makes a synchronous HTTP request by default. To make an- asynchronous HTTP request, please pass async_req=True+ self,+ new_instance: NewInstance,+ _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,+ ) -> Instance:+ """instances_post- >>> thread = api.instances_post(new_instance, async_req=True)- >>> result = thread.get()+ Create an instance from the environment:param new_instance: (required):type new_instance: NewInstance- :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.+ :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.- If the method is called asynchronously,- returns the request thread.- :rtype: Instance- """- kwargs["_return_http_data_only"] = True- if "_preload_content" in kwargs:- message = "Error! Please call the instances_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501- raise ValueError(message)- return self.instances_post_with_http_info(new_instance, **kwargs) # noqa: E501+ """ # noqa: E501++ _param = self._instances_post_serialize(+ new_instance=new_instance,+ _request_auth=_request_auth,+ _content_type=_content_type,+ _headers=_headers,+ _host_index=_host_index,+ )++ _response_types_map: Dict[str, Optional[str]] = {+ "201": "Instance",+ "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_calldef instances_post_with_http_info(- self, new_instance: NewInstance, **kwargs- ) -> ApiResponse: # noqa: E501- """instances_post # noqa: E501+ self,+ new_instance: NewInstance,+ _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[Instance]:+ """instances_post++ Create an instance from the environment++ :param new_instance: (required)+ :type new_instance: NewInstance+ :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._instances_post_serialize(+ new_instance=new_instance,+ _request_auth=_request_auth,+ _content_type=_content_type,+ _headers=_headers,+ _host_index=_host_index,+ )++ _response_types_map: Dict[str, Optional[str]] = {+ "201": "Instance",+ "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,+ )- Create an instance from the environment # noqa: E501- This method makes a synchronous HTTP request by default. To make an- asynchronous HTTP request, please pass async_req=True+ @validate_call+ def instances_post_without_preload_content(+ self,+ new_instance: NewInstance,+ _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:+ """instances_post- >>> thread = api.instances_post_with_http_info(new_instance, async_req=True)- >>> result = thread.get()+ Create an instance from the environment:param new_instance: (required):type new_instance: NewInstance- :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 onenumber provided, it will be total requesttimeout. 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.+ 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+ :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.- If the method is called asynchronously,- returns the request thread.- :rtype: tuple(Instance, status_code(int), headers(HTTPHeaderDict))- """-- _params = locals()-- _all_params = ["new_instance"]- _all_params.extend(- [- "async_req",- "_return_http_data_only",- "_preload_content",- "_request_timeout",- "_request_auth",- "_content_type",- "_headers",- ]+ """ # noqa: E501++ _param = self._instances_post_serialize(+ new_instance=new_instance,+ _request_auth=_request_auth,+ _content_type=_content_type,+ _headers=_headers,+ _host_index=_host_index,)- # 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 instances_post" % _key- )- _params[_key] = _val- del _params["kwargs"]+ _response_types_map: Dict[str, Optional[str]] = {+ "201": "Instance",+ "401": "Error",+ "400": "Error",+ "500": "Error",+ }+ response_data = self.api_client.call_api(+ *_param, _request_timeout=_request_timeout+ )+ return response_data.response- _collection_formats = {}+ def _instances_post_serialize(+ self,+ new_instance,+ _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- _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_instance"] is not None:- _body_params = _params["new_instance"]+ if new_instance is not None:+ _body_params = new_instance# 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+ 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 = ["ApiKeyAuth"] # noqa: E501-- _response_types_map = {- "201": "Instance",- "401": "Error",- "400": "Error",- "500": "Error",- }-- return self.api_client.call_api(- "/instances",- "POST",- _path_params,- _query_params,- _header_params,+ _auth_settings: List[str] = ["ApiKeyAuth"]++ return self.api_client.param_serialize(+ method="POST",+ resource_path="/instances",+ path_params=_path_params,+ query_params=_query_params,+ header_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"),+ _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.pyindex c4492a3cf..a25550038 100644--- a/packages/python-sdk/e2b/api/v2/client/api_client.py+++ b/packages/python-sdk/e2b/api/v2/client/api_client.py@@ -17,18 +17,26 @@ import datetimefrom dateutil.parser import parseimport jsonimport mimetypes-from multiprocessing.pool import ThreadPoolimport osimport reimport tempfilefrom urllib.parse import quote+from typing import Tuple, Optional, Listfrom e2b.api.v2.client.configuration import Configurationfrom e2b.api.v2.client.api_response import ApiResponseimport e2b.api.v2.client.modelsfrom e2b.api.v2.client import rest-from e2b.api.v2.client.exceptions import ApiValueError, ApiException+from e2b.api.v2.client.exceptions import (+ ApiValueError,+ ApiException,+ BadRequestException,+ UnauthorizedException,+ ForbiddenException,+ NotFoundException,+ ServiceException,+)class ApiClient:@@ -45,8 +53,6 @@ class ApiClient:the API.:param cookie: a cookie to include in the header when making callsto 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)@@ -63,18 +69,12 @@ class ApiClient:_pool = Nonedef __init__(- self,- configuration=None,- header_name=None,- header_value=None,- cookie=None,- pool_threads=1,+ self, configuration=None, header_name=None, header_value=None, cookie=None) -> None:# use default configuration if none is providedif configuration is None:configuration = Configuration.get_default()self.configuration = configuration- self.pool_threads = pool_threadsself.rest_client = rest.RESTClientObject(configuration)self.default_headers = {}@@ -89,25 +89,7 @@ class ApiClient:return selfdef __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+ pass@propertydef user_agent(self):@@ -147,25 +129,43 @@ class ApiClient:"""cls._default = default- def __call_api(+ def param_serialize(self,- resource_path,method,+ resource_path,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,- ):+ ) -> 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@@ -224,67 +224,108 @@ class ApiClient: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.request(+ response_data = self.rest_client.request(method,url,- query_params=query_params,headers=header_params,- post_params=post_params,body=body,- _preload_content=_preload_content,+ post_params=post_params,_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 derialization 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- )+ return response_data- 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+ 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+ """- 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,+ 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.@@ -310,7 +351,7 @@ class ApiClient:elif isinstance(obj, (datetime.datetime, datetime.date)):return obj.isoformat()- if isinstance(obj, dict):+ elif isinstance(obj, dict):obj_dict = objelse:# Convert model obj to dict except@@ -324,7 +365,7 @@ class ApiClient:key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}- def deserialize(self, response, response_type):+ def deserialize(self, response_text, response_type):"""Deserializes response into an object.:param response: RESTResponse object to be deserialized.@@ -333,16 +374,12 @@ class ApiClient::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 objecttry:- data = json.loads(response.data)+ data = json.loads(response_text)except ValueError:- data = response.data+ data = response_textreturn self.__deserialize(data, response_type)@@ -383,190 +420,6 @@ class ApiClient: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.- """- if not async_req:- return self.__call_api(- 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,- )-- return self.pool.apply_async(- self.__call_api,- (- 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,- ),- )-- 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.@@ -577,9 +430,7 @@ class ApiClient:new_params = []if collection_formats is None:collection_formats = {}- for k, v in (- params.items() if isinstance(params, dict) else params- ): # noqa: E501+ 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":@@ -608,13 +459,11 @@ class ApiClient: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, (int, float)):- v = str(v)+ 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)@@ -664,14 +513,14 @@ class ApiClient:return params- def select_header_accept(self, accepts):+ 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+ return Nonefor accept in accepts:if re.search("json", accept, re.IGNORECASE):@@ -703,7 +552,7 @@ class ApiClient:method,body,request_auth=None,- ):+ ) -> None:"""Updates header and query params based on authentication setting.:param headers: Header parameters dict to be updated.@@ -723,18 +572,17 @@ class ApiClient: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- )+ 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.@@ -761,6 +609,9 @@ class ApiClient: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."""diff --git a/packages/python-sdk/e2b/api/v2/client/api_response.py b/packages/python-sdk/e2b/api/v2/client/api_response.pyindex bb7e40032..f38555668 100644--- a/packages/python-sdk/e2b/api/v2/client/api_response.py+++ b/packages/python-sdk/e2b/api/v2/client/api_response.py@@ -1,28 +1,22 @@"""API response object."""from __future__ import annotations-from typing import Any, Dict, Optional-from pydantic import Field, StrictInt, StrictStr+from typing import Any, Dict, Optional, Generic, TypeVar+from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel+T = TypeVar("T")-class ApiResponse:++class ApiResponse(BaseModel, Generic[T]):"""API response object"""- status_code: Optional[StrictInt] = Field(None, description="HTTP status code")+ status_code: StrictInt = Field(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)")+ data: T = Field(description="Deserialized data given the data type")+ raw_data: StrictBytes = Field(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+ 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.pyindex 06354cf5f..f5effea9a 100644--- a/packages/python-sdk/e2b/api/v2/client/configuration.py+++ b/packages/python-sdk/e2b/api/v2/client/configuration.py@@ -14,7 +14,6 @@import copyimport logging-import multiprocessingimport sysimport urllib3@@ -180,14 +179,6 @@ class Configuration: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"""diff --git a/packages/python-sdk/e2b/api/v2/client/exceptions.py b/packages/python-sdk/e2b/api/v2/client/exceptions.pyindex 5a56914c5..af0c9a08b 100644--- a/packages/python-sdk/e2b/api/v2/client/exceptions.py+++ b/packages/python-sdk/e2b/api/v2/client/exceptions.py@@ -105,7 +105,7 @@ class ApiException(OpenApiException):if http_resp:self.status = http_resp.statusself.reason = http_resp.reason- self.body = http_resp.data+ self.body = http_resp.data.decode("utf-8")self.headers = http_resp.getheaders()else:self.status = statusdiff --git a/packages/python-sdk/e2b/api/v2/client/models/environment.py b/packages/python-sdk/e2b/api/v2/client/models/environment.pyindex a2f871846..15bda2507 100644--- a/packages/python-sdk/e2b/api/v2/client/models/environment.py+++ b/packages/python-sdk/e2b/api/v2/client/models/environment.py@@ -18,36 +18,37 @@ import re # noqa: F401import json-from typing import List, Optional-from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist+from typing import Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictBool, StrictStr+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Selfclass Environment(BaseModel):"""Environment- """+ """ # noqa: E501env_id: StrictStr = Field(- ..., alias="envID", description="Identifier of the environment"+ description="Identifier of the environment", alias="envID")build_id: StrictStr = Field(- ...,- alias="buildID",description="Identifier of the last successful build for given environment",+ alias="buildID",)public: StrictBool = Field(- ...,- description="Whether the environment is public or only accessible by the team",+ description="Whether the environment is public or only accessible by the team")- aliases: Optional[conlist(StrictStr)] = Field(- None, description="Aliases of the environment"+ aliases: Optional[List[StrictStr]] = Field(+ default=None, description="Aliases of the environment")+ __properties: ClassVar[List[str]] = ["envID", "buildID", "public", "aliases"]- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -55,39 +56,52 @@ class Environment(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> Environment:+ def from_json(cls, json_str: str) -> Self:"""Create an instance of Environment 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.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> Environment:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of Environment from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return Environment.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["envID", "buildID", "public", "aliases"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in Environment) in the input: "- + obj+ + _key)- _obj = Environment.model_validate(+ _obj = cls.model_validate({- "env_id": obj.get("envID"),- "build_id": obj.get("buildID"),+ "envID": obj.get("envID"),+ "buildID": obj.get("buildID"),"public": obj.get("public"),"aliases": obj.get("aliases"),}diff --git a/packages/python-sdk/e2b/api/v2/client/models/environment_build.py b/packages/python-sdk/e2b/api/v2/client/models/environment_build.pyindex 49e8ef17b..be6f6cc73 100644--- a/packages/python-sdk/e2b/api/v2/client/models/environment_build.py+++ b/packages/python-sdk/e2b/api/v2/client/models/environment_build.py@@ -18,23 +18,30 @@ import re # noqa: F401import json-from typing import List, Optional-from pydantic import BaseModel, Field, StrictStr, conlist, field_validator+from typing import Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictStr, field_validator+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Selfclass EnvironmentBuild(BaseModel):"""EnvironmentBuild- """+ """ # noqa: E501- logs: conlist(StrictStr) = Field(..., description="Build logs")+ logs: List[StrictStr] = Field(description="Build logs")env_id: StrictStr = Field(- ..., alias="envID", description="Identifier of the environment"+ description="Identifier of the environment", alias="envID")- build_id: StrictStr = Field(- ..., alias="buildID", description="Identifier of the build"+ build_id: StrictStr = Field(description="Identifier of the build", alias="buildID")+ status: Optional[StrictStr] = Field(+ default=None, description="Status of the environment")- status: Optional[StrictStr] = Field(None, description="Status of the environment")+ __properties: ClassVar[List[str]] = ["logs", "envID", "buildID", "status"]@field_validator("status")def status_validate_enum(cls, value):@@ -48,11 +55,7 @@ class EnvironmentBuild(BaseModel):)return value- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -60,40 +63,53 @@ class EnvironmentBuild(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> EnvironmentBuild:+ def from_json(cls, json_str: str) -> Self:"""Create an instance of EnvironmentBuild 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.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> EnvironmentBuild:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of EnvironmentBuild from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return EnvironmentBuild.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["logs", "envID", "buildID", "status"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in EnvironmentBuild) in the input: "- + obj+ + _key)- _obj = EnvironmentBuild.model_validate(+ _obj = cls.model_validate({"logs": obj.get("logs"),- "env_id": obj.get("envID"),- "build_id": obj.get("buildID"),+ "envID": obj.get("envID"),+ "buildID": obj.get("buildID"),"status": obj.get("status"),})diff --git a/packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.py b/packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.pyindex ad1f55713..203198a5a 100644--- a/packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.py+++ b/packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.py@@ -18,23 +18,26 @@ import re # noqa: F401import json-from typing import List-from pydantic import BaseModel, Field, StrictStr, conlist+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 Selfclass EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):"""EnvsEnvIDBuildsBuildIDLogsPostRequest- """+ """ # noqa: E501- api_secret: StrictStr = Field(..., alias="apiSecret", description="API secret")- logs: conlist(StrictStr) = Field(...)+ api_secret: StrictStr = Field(description="API secret", alias="apiSecret")+ logs: List[StrictStr]+ __properties: ClassVar[List[str]] = ["apiSecret", "logs"]- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -42,36 +45,49 @@ class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> EnvsEnvIDBuildsBuildIDLogsPostRequest:+ def from_json(cls, json_str: str) -> Self:"""Create an instance of EnvsEnvIDBuildsBuildIDLogsPostRequest 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.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> EnvsEnvIDBuildsBuildIDLogsPostRequest:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of EnvsEnvIDBuildsBuildIDLogsPostRequest from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return EnvsEnvIDBuildsBuildIDLogsPostRequest.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["apiSecret", "logs"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in EnvsEnvIDBuildsBuildIDLogsPostRequest) in the input: "- + obj+ + _key)- _obj = EnvsEnvIDBuildsBuildIDLogsPostRequest.model_validate(- {"api_secret": obj.get("apiSecret"), "logs": obj.get("logs")}+ _obj = cls.model_validate(+ {"apiSecret": obj.get("apiSecret"), "logs": obj.get("logs")})return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/error.py b/packages/python-sdk/e2b/api/v2/client/models/error.pyindex 7eadb2165..ab130208d 100644--- a/packages/python-sdk/e2b/api/v2/client/models/error.py+++ b/packages/python-sdk/e2b/api/v2/client/models/error.py@@ -18,22 +18,26 @@ import re # noqa: F401import json-from pydantic import BaseModel, Field, StrictInt, StrictStr+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 Selfclass Error(BaseModel):"""Error- """+ """ # noqa: E501- code: StrictInt = Field(..., description="Error code")- message: StrictStr = Field(..., description="Error")+ code: StrictInt = Field(description="Error code")+ message: StrictStr = Field(description="Error")+ __properties: ClassVar[List[str]] = ["code", "message"]- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -41,36 +45,49 @@ class Error(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> Error:+ 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):- """Returns the dictionary representation of the model using alias"""- _dict = self.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> Error:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of Error from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return Error.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["code", "message"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in Error) in the input: "- + obj+ + _key)- _obj = Error.model_validate(+ _obj = cls.model_validate({"code": obj.get("code"), "message": obj.get("message")})return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/instance.py b/packages/python-sdk/e2b/api/v2/client/models/instance.pyindex 722beac24..c23a569ae 100644--- a/packages/python-sdk/e2b/api/v2/client/models/instance.py+++ b/packages/python-sdk/e2b/api/v2/client/models/instance.py@@ -18,31 +18,34 @@ import re # noqa: F401import json-from pydantic import BaseModel, Field, StrictStr+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 Selfclass Instance(BaseModel):"""Instance- """+ """ # noqa: E501env_id: StrictStr = Field(- ...,- alias="envID",description="Identifier of the environment from which is the instance created",+ alias="envID",)instance_id: StrictStr = Field(- ..., alias="instanceID", description="Identifier of the instance"+ description="Identifier of the instance", alias="instanceID")client_id: StrictStr = Field(- ..., alias="clientID", description="Identifier of the client"+ description="Identifier of the client", alias="clientID")+ __properties: ClassVar[List[str]] = ["envID", "instanceID", "clientID"]- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -50,40 +53,53 @@ class Instance(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> Instance:+ def from_json(cls, json_str: str) -> Self:"""Create an instance of Instance 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.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> Instance:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of Instance from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return Instance.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["envID", "instanceID", "clientID"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in Instance) in the input: "- + obj+ + _key)- _obj = Instance.model_validate(+ _obj = cls.model_validate({- "env_id": obj.get("envID"),- "instance_id": obj.get("instanceID"),- "client_id": obj.get("clientID"),+ "envID": obj.get("envID"),+ "instanceID": obj.get("instanceID"),+ "clientID": obj.get("clientID"),})return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/instances_instance_id_refreshes_post_request.py b/packages/python-sdk/e2b/api/v2/client/models/instances_instance_id_refreshes_post_request.pyindex e81f9f35f..842783d1f 100644--- a/packages/python-sdk/e2b/api/v2/client/models/instances_instance_id_refreshes_post_request.py+++ b/packages/python-sdk/e2b/api/v2/client/models/instances_instance_id_refreshes_post_request.py@@ -18,24 +18,29 @@ import re # noqa: F401import json-from pydantic import BaseModel, Field, conint+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 Selfclass InstancesInstanceIDRefreshesPostRequest(BaseModel):"""InstancesInstanceIDRefreshesPostRequest- """+ """ # noqa: E501- duration: conint(strict=True, le=3600, ge=0) = Field(- ...,+ duration: Optional[Annotated[int, Field(le=3600, strict=True, ge=0)]] = Field(+ default=None,description="Duration for which the instance should be kept alive in seconds",)+ __properties: ClassVar[List[str]] = ["duration"]- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -43,36 +48,47 @@ class InstancesInstanceIDRefreshesPostRequest(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> InstancesInstanceIDRefreshesPostRequest:+ def from_json(cls, json_str: str) -> Self:"""Create an instance of InstancesInstanceIDRefreshesPostRequest 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.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> InstancesInstanceIDRefreshesPostRequest:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of InstancesInstanceIDRefreshesPostRequest from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return InstancesInstanceIDRefreshesPostRequest.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["duration"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in InstancesInstanceIDRefreshesPostRequest) in the input: "- + obj+ + _key)- _obj = InstancesInstanceIDRefreshesPostRequest.model_validate(- {"duration": obj.get("duration")}- )+ _obj = cls.model_validate({"duration": obj.get("duration")})return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/new_instance.py b/packages/python-sdk/e2b/api/v2/client/models/new_instance.pyindex 21927f301..35ca42054 100644--- a/packages/python-sdk/e2b/api/v2/client/models/new_instance.py+++ b/packages/python-sdk/e2b/api/v2/client/models/new_instance.py@@ -18,23 +18,27 @@ import re # noqa: F401import json-from pydantic import BaseModel, Field, StrictStr+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 Selfclass NewInstance(BaseModel):"""NewInstance- """+ """ # noqa: E501env_id: StrictStr = Field(- ..., alias="envID", description="Identifier of the required environment"+ description="Identifier of the required environment", alias="envID")+ __properties: ClassVar[List[str]] = ["envID"]- """Pydantic configuration"""- model_config = {- "populate_by_name": True,- "validate_assignment": True,- }+ model_config = {"populate_by_name": True, "validate_assignment": True}def to_str(self) -> str:"""Returns the string representation of the model using alias"""@@ -42,34 +46,47 @@ class NewInstance(BaseModel):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) insteadreturn json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> NewInstance:+ def from_json(cls, json_str: str) -> Self:"""Create an instance of NewInstance 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.model_dump(by_alias=True, exclude={}, exclude_none=True)+ 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.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={},+ exclude_none=True,+ )return _dict@classmethod- def from_dict(cls, obj: dict) -> NewInstance:+ def from_dict(cls, obj: Dict) -> Self:"""Create an instance of NewInstance from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return NewInstance.model_validate(obj)+ return cls.model_validate(obj)# raise errors for additional fields in the inputfor _key in obj.keys():- if _key not in ["envID"]:+ if _key not in cls.__properties:raise ValueError("Error due to additional fields (not defined in NewInstance) in the input: "- + obj+ + _key)- _obj = NewInstance.model_validate({"env_id": obj.get("envID")})+ _obj = cls.model_validate({"envID": obj.get("envID")})return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/rest.py b/packages/python-sdk/e2b/api/v2/client/rest.pyindex 3ac979fd9..1bdeb9e07 100644--- a/packages/python-sdk/e2b/api/v2/client/rest.py+++ b/packages/python-sdk/e2b/api/v2/client/rest.py@@ -14,49 +14,42 @@import ioimport json-import loggingimport reimport ssl-from urllib.parse import urlencode, quote_plusimport urllib3-from e2b.api.v2.client.exceptions import (- ApiException,- UnauthorizedException,- ForbiddenException,- NotFoundException,- ServiceException,- ApiValueError,- BadRequestException,-)+from e2b.api.v2.client.exceptions import ApiException, ApiValueError--logger = logging.getLogger(__name__)+RESTResponseType = urllib3.HTTPResponseclass RESTResponse(io.IOBase):def __init__(self, resp) -> None:- self.urllib3_response = resp+ self.response = respself.status = resp.statusself.reason = resp.reason- self.data = resp.data+ self.data = None++ def read(self):+ if self.data is None:+ self.data = self.response.data+ return self.datadef getheaders(self):"""Returns a dictionary of the response headers."""- return self.urllib3_response.headers+ return self.response.headersdef getheader(self, name, default=None):"""Returns a given response header."""- return self.urllib3_response.headers.get(name, default)+ return self.response.headers.get(name, default)class RESTClientObject:- def __init__(self, configuration, pools_size=4, maxsize=None) -> None:+ 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- # 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@@ -67,9 +60,7 @@ class RESTClientObject:addition_pool_args = {}if configuration.assert_hostname is not None:- addition_pool_args[- "assert_hostname"- ] = configuration.assert_hostname # noqa: E501+ addition_pool_args["assert_hostname"] = configuration.assert_hostnameif configuration.retries is not None:addition_pool_args["retries"] = configuration.retries@@ -80,17 +71,9 @@ class RESTClientObject: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 managerif 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,@@ -101,8 +84,6 @@ class RESTClientObject:)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,@@ -114,26 +95,20 @@ class RESTClientObject: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 onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -149,13 +124,10 @@ class RESTClientObject: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 = Noneif _request_timeout:- if isinstance(_request_timeout, (int, float)): # noqa: E501,F821+ 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(@@ -166,9 +138,8 @@ class RESTClientObject:# 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- ):+ content_type = headers.get("Content-Type")+ if not content_type or re.search("json", content_type, re.IGNORECASE):request_body = Noneif body is not None:request_body = json.dumps(body)@@ -176,23 +147,21 @@ class RESTClientObject:method,url,body=request_body,- preload_content=_preload_content,timeout=timeout,headers=headers,+ preload_content=False,)- elif (- headers["Content-Type"] == "application/x-www-form-urlencoded"- ): # noqa: E501+ elif content_type == "application/x-www-form-urlencoded":r = self.pool_manager.request(method,url,fields=post_params,encode_multipart=False,- preload_content=_preload_content,timeout=timeout,headers=headers,+ preload_content=False,)- elif headers["Content-Type"] == "multipart/form-data":+ elif content_type == "multipart/form-data":# must del headers['Content-Type'], or the correct# Content-Type which generated by urllib3 will be# overwritten.@@ -202,9 +171,9 @@ class RESTClientObject:url,fields=post_params,encode_multipart=True,- preload_content=_preload_content,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@@ -215,9 +184,9 @@ class RESTClientObject:method,url,body=request_body,- preload_content=_preload_content,timeout=timeout,headers=headers,+ preload_content=False,)else:# Cannot generate the request from given parameters@@ -231,173 +200,12 @@ class RESTClientObject:method,url,fields={},- preload_content=_preload_content,timeout=timeout,headers=headers,+ preload_content=False,)except urllib3.exceptions.SSLError as e:- msg = "{0}\n{1}".format(type(e).__name__, str(e))+ msg = "\n".join([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,- )+ return RESTResponse(r)diff --git a/packages/python-sdk/e2b/api/v2/client_README.md b/packages/python-sdk/e2b/api/v2/client_README.mdindex 7c17b796e..e60f09ce8 100644--- a/packages/python-sdk/e2b/api/v2/client_README.md+++ b/packages/python-sdk/e2b/api/v2/client_README.md@@ -20,7 +20,6 @@ To be able to use it, you will need these dependencies in your own package that* urllib3 >= 1.25.3* python-dateutil* pydantic-* aenum## Getting Starteddiff --git a/packages/python-sdk/e2b/sandbox/main.py b/packages/python-sdk/e2b/sandbox/main.pyindex 84195b3b6..91e39e65d 100644--- a/packages/python-sdk/e2b/sandbox/main.py+++ b/packages/python-sdk/e2b/sandbox/main.py@@ -5,7 +5,7 @@ import requestsfrom os import pathfrom typing import Any, Callable, Dict, List, Literal, Optional, IO, Tuple, Union-from e2b.api.v2.client import models+from e2b.api import modelsfrom e2b.constants import TIMEOUT, ENVD_PORT, FILE_ROUTEfrom e2b.sandbox.code_snippet import CodeSnippetManager, OpenPortfrom e2b.sandbox.env_vars import EnvVarsdiff --git a/packages/python-sdk/e2b/sandbox/sandbox_connection.py b/packages/python-sdk/e2b/sandbox/sandbox_connection.pyindex 9e77a063d..bb17e7800 100644--- a/packages/python-sdk/e2b/sandbox/sandbox_connection.py+++ b/packages/python-sdk/e2b/sandbox/sandbox_connection.py@@ -11,7 +11,6 @@ from pydantic import BaseModelfrom urllib3.exceptions import ReadTimeoutError, MaxRetryError, ConnectTimeoutErrorfrom e2b.api import E2BApiClient, exceptions, models, client-from e2b.api.v2.client import InstancesInstanceIDRefreshesPostRequestfrom e2b.constants import (SANDBOX_DOMAIN,SANDBOX_REFRESH_PERIOD,@@ -163,7 +162,7 @@ class SandboxConnection:try:api.instances_instance_id_refreshes_post(self._sandbox.instance_id,- InstancesInstanceIDRefreshesPostRequest(duration=duration),+ client.InstancesInstanceIDRefreshesPostRequest(duration=duration),)logger.debug(f"Sandbox will be kept alive without connection for next {duration} seconds."@@ -382,7 +381,7 @@ class SandboxConnection:try:api.instances_instance_id_refreshes_post(instance_id,- InstancesInstanceIDRefreshesPostRequest(duration=0),+ client.InstancesInstanceIDRefreshesPostRequest(duration=0),)logger.debug(f"Refreshed sandbox {instance_id}")except exceptions.ApiException as e:diff --git a/packages/python-sdk/openapitools.json b/packages/python-sdk/openapitools.jsonindex cd53ff4ca..15fef607c 100644--- a/packages/python-sdk/openapitools.json+++ b/packages/python-sdk/openapitools.json@@ -2,6 +2,6 @@"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json","spaces": 2,"generator-cli": {- "version": "6.6.0"+ "version": "7.1.0"}}