@@ -31,9 +31,6 @@ class ApiParams(TypedDict, total=False):
3131 api_headers : Optional [Dict [str , str ]]
3232 """Additional headers to send with E2B API requests."""
3333
34- integration : Optional [str ]
35- """Integration wrapping the E2B SDK, appended to the User-Agent."""
36-
3734 api_key : Optional [str ]
3835 """E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable."""
3936
@@ -148,9 +145,10 @@ def __init__(
148145 self .access_token = access_token or ConnectionConfig ._access_token ()
149146 self .integration = integration
150147 self .headers = {** (headers or {}), ** (api_headers or {})}
151- self .headers ["User-Agent" ] = self ._build_user_agent (
152- self .integration ,
153- )
148+ if self .integration is not None or "User-Agent" not in self .headers :
149+ self .headers ["User-Agent" ] = self ._build_user_agent (
150+ self .integration ,
151+ )
154152 self .__extra_sandbox_headers = extra_sandbox_headers or {}
155153
156154 self .proxy = proxy
@@ -240,7 +238,6 @@ def get_api_params(
240238 """
241239 headers = opts .get ("headers" )
242240 api_headers = opts .get ("api_headers" )
243- integration = opts .get ("integration" , self .integration )
244241 request_timeout = opts .get ("request_timeout" )
245242 api_key = opts .get ("api_key" )
246243 validate_api_key = opts .get ("validate_api_key" )
@@ -255,9 +252,9 @@ def get_api_params(
255252 req_headers .update (headers )
256253 if api_headers is not None :
257254 req_headers .update (api_headers )
258- if integration is not None :
255+ if self . integration is not None :
259256 req_headers ["User-Agent" ] = self ._build_user_agent (
260- integration ,
257+ self . integration ,
261258 )
262259
263260 # `logger` is a construction-time option rather than a per-request
@@ -279,7 +276,6 @@ def get_api_params(
279276 debug = debug if debug is not None else self .debug ,
280277 request_timeout = self .get_request_timeout (request_timeout ),
281278 headers = req_headers ,
282- integration = integration ,
283279 proxy = proxy if proxy is not None else self .proxy ,
284280 sandbox_url = (
285281 sandbox_url
0 commit comments