asteroid-odyssey 1.0.2__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/PKG-INFO +1 -1
  2. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/pyproject.toml +1 -1
  3. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/client.py +33 -18
  4. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/__init__.py +0 -2
  5. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/api/__init__.py +0 -1
  6. asteroid_odyssey-1.0.2/src/asteroid_odyssey/openapi_client/api/sdk_api.py → asteroid_odyssey-1.1.0/src/asteroid_odyssey/openapi_client/api/execution_api.py +307 -7
  7. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey.egg-info/PKG-INFO +1 -1
  8. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey.egg-info/SOURCES.txt +0 -2
  9. asteroid_odyssey-1.0.2/test/test_sdk_api.py → asteroid_odyssey-1.1.0/test/test_execution_api.py +11 -4
  10. asteroid_odyssey-1.0.2/src/asteroid_odyssey/openapi_client/api/execution_api.py +0 -335
  11. asteroid_odyssey-1.0.2/test/test_execution_api.py +0 -38
  12. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/README.md +0 -0
  13. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/setup.cfg +0 -0
  14. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/__init__.py +0 -0
  15. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/api/api_api.py +0 -0
  16. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/api_client.py +0 -0
  17. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/api_response.py +0 -0
  18. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/configuration.py +0 -0
  19. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/exceptions.py +0 -0
  20. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/__init__.py +0 -0
  21. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/browser_session_recording_response.py +0 -0
  22. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/error_response.py +0 -0
  23. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/execution_response.py +0 -0
  24. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/execution_result.py +0 -0
  25. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/execution_result_response.py +0 -0
  26. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/execution_status_response.py +0 -0
  27. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/health_check200_response.py +0 -0
  28. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/health_check500_response.py +0 -0
  29. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/status.py +0 -0
  30. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/structured_agent_execution_request.py +0 -0
  31. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/models/upload_execution_files200_response.py +0 -0
  32. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/py.typed +0 -0
  33. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey/openapi_client/rest.py +0 -0
  34. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey.egg-info/dependency_links.txt +0 -0
  35. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey.egg-info/requires.txt +0 -0
  36. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/src/asteroid_odyssey.egg-info/top_level.txt +0 -0
  37. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_api_api.py +0 -0
  38. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_browser_session_recording_response.py +0 -0
  39. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_error_response.py +0 -0
  40. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_execution_response.py +0 -0
  41. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_execution_result.py +0 -0
  42. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_execution_result_response.py +0 -0
  43. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_execution_status_response.py +0 -0
  44. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_health_check200_response.py +0 -0
  45. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_health_check500_response.py +0 -0
  46. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_status.py +0 -0
  47. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_structured_agent_execution_request.py +0 -0
  48. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.1.0}/test/test_upload_execution_files200_response.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asteroid-odyssey
3
- Version: 1.0.2
3
+ Version: 1.1.0
4
4
  Summary: A Python SDK for browser automation using Asteroid platform.
5
5
  Author-email: David Mlcoch <founders@asteroid.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "asteroid-odyssey"
3
- version = "1.0.2"
3
+ version = "1.1.0"
4
4
  authors = [
5
5
  { name = "David Mlcoch", email = "founders@asteroid.com" },
6
6
  ]
@@ -10,11 +10,12 @@ without modifying any generated files.
10
10
 
11
11
  import time
12
12
  import os
13
+ import logging
13
14
  from typing import Dict, Any, Optional, List, Union, Tuple
14
15
  from .openapi_client import (
15
16
  Configuration,
16
17
  ApiClient,
17
- SDKApi,
18
+ APIApi,
18
19
  ExecutionApi,
19
20
  ExecutionStatusResponse,
20
21
  ExecutionResultResponse,
@@ -55,17 +56,17 @@ class AsteroidClient:
55
56
  )
56
57
 
57
58
  self.api_client = ApiClient(config)
58
- self.sdk_api = SDKApi(self.api_client)
59
+ self.api_api = APIApi(self.api_client)
59
60
  self.execution_api = ExecutionApi(self.api_client)
60
61
 
61
- def execute_agent(self, agent_id: str, execution_data: Dict[str, Any]) -> str:
62
+ def execute_agent(self, agent_id: str, execution_data: Dict[str, Any], agent_profile_id: Optional[str] = None) -> str:
62
63
  """
63
64
  Execute an agent with the provided parameters.
64
65
 
65
66
  Args:
66
67
  agent_id: The ID of the agent to execute
67
- agent_profile_id: The ID of the agent profile
68
68
  execution_data: The execution parameters
69
+ agent_profile_id: Optional ID of the agent profile
69
70
 
70
71
  Returns:
71
72
  The execution ID
@@ -74,11 +75,11 @@ class AsteroidClient:
74
75
  Exception: If the execution request fails
75
76
 
76
77
  Example:
77
- execution_id = client.execute_structured_agent('my-agent-id', 'agent-profile-id', {'input': 'some dynamic value'})
78
+ execution_id = client.execute_agent('my-agent-id', {'input': 'some dynamic value'}, 'agent-profile-id')
78
79
  """
79
- req = StructuredAgentExecutionRequest(dynamic_data=execution_data)
80
+ req = StructuredAgentExecutionRequest(dynamic_data=execution_data, agent_profile_id=agent_profile_id)
80
81
  try:
81
- response = self.sdk_api.execute_agent_structured(agent_id, req)
82
+ response = self.execution_api.execute_agent_structured(agent_id, req)
82
83
  return response.execution_id
83
84
  except ApiException as e:
84
85
  raise Exception(f"Failed to execute agent: {e}")
@@ -101,7 +102,7 @@ class AsteroidClient:
101
102
  print(status.status)
102
103
  """
103
104
  try:
104
- return self.sdk_api.get_execution_status(execution_id)
105
+ return self.execution_api.get_execution_status(execution_id)
105
106
  except ApiException as e:
106
107
  raise Exception(f"Failed to get execution status: {e}")
107
108
 
@@ -123,12 +124,12 @@ class AsteroidClient:
123
124
  print(result)
124
125
  """
125
126
  try:
126
- response = self.sdk_api.get_execution_result(execution_id)
127
+ response = self.execution_api.get_execution_result(execution_id)
127
128
 
128
129
  if response.error:
129
130
  raise Exception(response.error)
130
131
 
131
- return response.result or {}
132
+ return response.execution_result or {}
132
133
  except ApiException as e:
133
134
  raise Exception(f"Failed to get execution result: {e}")
134
135
 
@@ -269,7 +270,7 @@ class AsteroidClient:
269
270
  print(f"Recording available at: {recording_url}")
270
271
  """
271
272
  try:
272
- response = self.sdk_api.get_browser_session_recording(execution_id)
273
+ response = self.execution_api.get_browser_session_recording(execution_id)
273
274
  return response.recording_url
274
275
  except ApiException as e:
275
276
  raise Exception(f"Failed to get browser session recording: {e}")
@@ -278,9 +279,23 @@ class AsteroidClient:
278
279
  """Context manager entry."""
279
280
  return self
280
281
 
281
- def __exit__(self, exc_type, exc_value, traceback):
282
- """Context manager exit."""
283
- pass
282
+ def __exit__(self, exc_type, exc_value, tb):
283
+ """Context manager exit: clean up API client connection pool."""
284
+ try:
285
+ # Try to grab the pool_manager; if any attr is missing, skip
286
+ try:
287
+ pool_manager = self.api_client.rest_client.pool_manager
288
+ except AttributeError:
289
+ pool_manager = None
290
+
291
+ if pool_manager:
292
+ pool_manager.clear()
293
+ except Exception as e:
294
+ # Log but don't mask the original exception (if any)
295
+ logging.warning("Failed to clear connection pool: %s", e)
296
+
297
+ # Returning False allows any exception in the 'with' block to propagate
298
+ return False
284
299
 
285
300
 
286
301
  # Convenience functions that mirror the TypeScript SDK pattern
@@ -302,23 +317,23 @@ def create_client(api_key: str, base_url: Optional[str] = None) -> AsteroidClien
302
317
  """
303
318
  return AsteroidClient(api_key, base_url)
304
319
 
305
- def execute_agent(client: AsteroidClient, agent_id: str, agent_profile_id: str, execution_data: Dict[str, Any]) -> str:
320
+ def execute_agent(client: AsteroidClient, agent_id: str, execution_data: Dict[str, Any], agent_profile_id: Optional[str] = None) -> str:
306
321
  """
307
322
  Execute an agent with the provided parameters.
308
323
 
309
324
  Args:
310
325
  client: The AsteroidClient instance
311
326
  agent_id: The ID of the agent to execute
312
- agent_profile_id: The ID of the agent profile
313
327
  execution_data: The execution parameters
328
+ agent_profile_id: Optional ID of the agent profile
314
329
 
315
330
  Returns:
316
331
  The execution ID
317
332
 
318
333
  Example:
319
- execution_id = execute_agent(client, 'my-agent-id', {'input': 'some dynamic value'})
334
+ execution_id = execute_agent(client, 'my-agent-id', {'input': 'some dynamic value'}, 'agent-profile-id')
320
335
  """
321
- return client.execute_agent(agent_id, agent_profile_id, execution_data)
336
+ return client.execute_agent(agent_id, execution_data, agent_profile_id)
322
337
 
323
338
 
324
339
 
@@ -20,7 +20,6 @@ __version__ = "1.0.0"
20
20
  __all__ = [
21
21
  "APIApi",
22
22
  "ExecutionApi",
23
- "SDKApi",
24
23
  "ApiResponse",
25
24
  "ApiClient",
26
25
  "Configuration",
@@ -46,7 +45,6 @@ __all__ = [
46
45
  # import apis into sdk package
47
46
  from asteroid_odyssey.openapi_client.api.api_api import APIApi as APIApi
48
47
  from asteroid_odyssey.openapi_client.api.execution_api import ExecutionApi as ExecutionApi
49
- from asteroid_odyssey.openapi_client.api.sdk_api import SDKApi as SDKApi
50
48
 
51
49
  # import ApiClient
52
50
  from asteroid_odyssey.openapi_client.api_response import ApiResponse as ApiResponse
@@ -3,5 +3,4 @@
3
3
  # import apis into api package
4
4
  from asteroid_odyssey.openapi_client.api.api_api import APIApi
5
5
  from asteroid_odyssey.openapi_client.api.execution_api import ExecutionApi
6
- from asteroid_odyssey.openapi_client.api.sdk_api import SDKApi
7
6
 
@@ -16,21 +16,22 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
16
  from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
- from pydantic import Field, StrictStr
20
- from typing import Any, Dict
19
+ from pydantic import Field, StrictBytes, StrictStr
20
+ from typing import Any, Dict, List, Optional, Tuple, Union
21
21
  from typing_extensions import Annotated
22
22
  from asteroid_odyssey.openapi_client.models.browser_session_recording_response import BrowserSessionRecordingResponse
23
23
  from asteroid_odyssey.openapi_client.models.execution_response import ExecutionResponse
24
24
  from asteroid_odyssey.openapi_client.models.execution_result_response import ExecutionResultResponse
25
25
  from asteroid_odyssey.openapi_client.models.execution_status_response import ExecutionStatusResponse
26
26
  from asteroid_odyssey.openapi_client.models.structured_agent_execution_request import StructuredAgentExecutionRequest
27
+ from asteroid_odyssey.openapi_client.models.upload_execution_files200_response import UploadExecutionFiles200Response
27
28
 
28
29
  from asteroid_odyssey.openapi_client.api_client import ApiClient, RequestSerialized
29
30
  from asteroid_odyssey.openapi_client.api_response import ApiResponse
30
31
  from asteroid_odyssey.openapi_client.rest import RESTResponseType
31
32
 
32
33
 
33
- class SDKApi:
34
+ class ExecutionApi:
34
35
  """NOTE: This class is auto generated by OpenAPI Generator
35
36
  Ref: https://openapi-generator.tech
36
37
 
@@ -61,7 +62,7 @@ class SDKApi:
61
62
  _headers: Optional[Dict[StrictStr, Any]] = None,
62
63
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
63
64
  ) -> ExecutionResponse:
64
- """Execute an agent
65
+ """(Deprecated) Execute an agent
65
66
 
66
67
  Executes an agent with the provided parameters
67
68
 
@@ -90,6 +91,7 @@ class SDKApi:
90
91
  :type _host_index: int, optional
91
92
  :return: Returns the result object.
92
93
  """ # noqa: E501
94
+ warnings.warn("POST /agent/{id} is deprecated.", DeprecationWarning)
93
95
 
94
96
  _param = self._execute_agent_serialize(
95
97
  id=id,
@@ -135,7 +137,7 @@ class SDKApi:
135
137
  _headers: Optional[Dict[StrictStr, Any]] = None,
136
138
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
137
139
  ) -> ApiResponse[ExecutionResponse]:
138
- """Execute an agent
140
+ """(Deprecated) Execute an agent
139
141
 
140
142
  Executes an agent with the provided parameters
141
143
 
@@ -164,6 +166,7 @@ class SDKApi:
164
166
  :type _host_index: int, optional
165
167
  :return: Returns the result object.
166
168
  """ # noqa: E501
169
+ warnings.warn("POST /agent/{id} is deprecated.", DeprecationWarning)
167
170
 
168
171
  _param = self._execute_agent_serialize(
169
172
  id=id,
@@ -209,7 +212,7 @@ class SDKApi:
209
212
  _headers: Optional[Dict[StrictStr, Any]] = None,
210
213
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
211
214
  ) -> RESTResponseType:
212
- """Execute an agent
215
+ """(Deprecated) Execute an agent
213
216
 
214
217
  Executes an agent with the provided parameters
215
218
 
@@ -238,6 +241,7 @@ class SDKApi:
238
241
  :type _host_index: int, optional
239
242
  :return: Returns the result object.
240
243
  """ # noqa: E501
244
+ warnings.warn("POST /agent/{id} is deprecated.", DeprecationWarning)
241
245
 
242
246
  _param = self._execute_agent_serialize(
243
247
  id=id,
@@ -556,7 +560,7 @@ class SDKApi:
556
560
  *_param,
557
561
  _request_timeout=_request_timeout
558
562
  )
559
- return response_data.response
563
+ return response_data.execution_response
560
564
 
561
565
 
562
566
  def _execute_agent_structured_serialize(
@@ -1432,3 +1436,299 @@ class SDKApi:
1432
1436
  )
1433
1437
 
1434
1438
 
1439
+
1440
+
1441
+ @validate_call
1442
+ def upload_execution_files(
1443
+ self,
1444
+ id: Annotated[StrictStr, Field(description="The ID of the execution")],
1445
+ files: Annotated[Optional[List[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]], Field(description="Files to upload to the execution")] = None,
1446
+ _request_timeout: Union[
1447
+ None,
1448
+ Annotated[StrictFloat, Field(gt=0)],
1449
+ Tuple[
1450
+ Annotated[StrictFloat, Field(gt=0)],
1451
+ Annotated[StrictFloat, Field(gt=0)]
1452
+ ]
1453
+ ] = None,
1454
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1455
+ _content_type: Optional[StrictStr] = None,
1456
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1457
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1458
+ ) -> UploadExecutionFiles200Response:
1459
+ """Upload files to an execution
1460
+
1461
+
1462
+ :param id: The ID of the execution (required)
1463
+ :type id: str
1464
+ :param files: Files to upload to the execution
1465
+ :type files: List[bytearray]
1466
+ :param _request_timeout: timeout setting for this request. If one
1467
+ number provided, it will be total request
1468
+ timeout. It can also be a pair (tuple) of
1469
+ (connection, read) timeouts.
1470
+ :type _request_timeout: int, tuple(int, int), optional
1471
+ :param _request_auth: set to override the auth_settings for an a single
1472
+ request; this effectively ignores the
1473
+ authentication in the spec for a single request.
1474
+ :type _request_auth: dict, optional
1475
+ :param _content_type: force content-type for the request.
1476
+ :type _content_type: str, Optional
1477
+ :param _headers: set to override the headers for a single
1478
+ request; this effectively ignores the headers
1479
+ in the spec for a single request.
1480
+ :type _headers: dict, optional
1481
+ :param _host_index: set to override the host_index for a single
1482
+ request; this effectively ignores the host_index
1483
+ in the spec for a single request.
1484
+ :type _host_index: int, optional
1485
+ :return: Returns the result object.
1486
+ """ # noqa: E501
1487
+
1488
+ _param = self._upload_execution_files_serialize(
1489
+ id=id,
1490
+ files=files,
1491
+ _request_auth=_request_auth,
1492
+ _content_type=_content_type,
1493
+ _headers=_headers,
1494
+ _host_index=_host_index
1495
+ )
1496
+
1497
+ _response_types_map: Dict[str, Optional[str]] = {
1498
+ '200': "UploadExecutionFiles200Response",
1499
+ '400': "ErrorResponse",
1500
+ '401': "ErrorResponse",
1501
+ '404': "ErrorResponse",
1502
+ }
1503
+ response_data = self.api_client.call_api(
1504
+ *_param,
1505
+ _request_timeout=_request_timeout
1506
+ )
1507
+ response_data.read()
1508
+ return self.api_client.response_deserialize(
1509
+ response_data=response_data,
1510
+ response_types_map=_response_types_map,
1511
+ ).data
1512
+
1513
+
1514
+ @validate_call
1515
+ def upload_execution_files_with_http_info(
1516
+ self,
1517
+ id: Annotated[StrictStr, Field(description="The ID of the execution")],
1518
+ files: Annotated[Optional[List[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]], Field(description="Files to upload to the execution")] = None,
1519
+ _request_timeout: Union[
1520
+ None,
1521
+ Annotated[StrictFloat, Field(gt=0)],
1522
+ Tuple[
1523
+ Annotated[StrictFloat, Field(gt=0)],
1524
+ Annotated[StrictFloat, Field(gt=0)]
1525
+ ]
1526
+ ] = None,
1527
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1528
+ _content_type: Optional[StrictStr] = None,
1529
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1530
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1531
+ ) -> ApiResponse[UploadExecutionFiles200Response]:
1532
+ """Upload files to an execution
1533
+
1534
+
1535
+ :param id: The ID of the execution (required)
1536
+ :type id: str
1537
+ :param files: Files to upload to the execution
1538
+ :type files: List[bytearray]
1539
+ :param _request_timeout: timeout setting for this request. If one
1540
+ number provided, it will be total request
1541
+ timeout. It can also be a pair (tuple) of
1542
+ (connection, read) timeouts.
1543
+ :type _request_timeout: int, tuple(int, int), optional
1544
+ :param _request_auth: set to override the auth_settings for an a single
1545
+ request; this effectively ignores the
1546
+ authentication in the spec for a single request.
1547
+ :type _request_auth: dict, optional
1548
+ :param _content_type: force content-type for the request.
1549
+ :type _content_type: str, Optional
1550
+ :param _headers: set to override the headers for a single
1551
+ request; this effectively ignores the headers
1552
+ in the spec for a single request.
1553
+ :type _headers: dict, optional
1554
+ :param _host_index: set to override the host_index for a single
1555
+ request; this effectively ignores the host_index
1556
+ in the spec for a single request.
1557
+ :type _host_index: int, optional
1558
+ :return: Returns the result object.
1559
+ """ # noqa: E501
1560
+
1561
+ _param = self._upload_execution_files_serialize(
1562
+ id=id,
1563
+ files=files,
1564
+ _request_auth=_request_auth,
1565
+ _content_type=_content_type,
1566
+ _headers=_headers,
1567
+ _host_index=_host_index
1568
+ )
1569
+
1570
+ _response_types_map: Dict[str, Optional[str]] = {
1571
+ '200': "UploadExecutionFiles200Response",
1572
+ '400': "ErrorResponse",
1573
+ '401': "ErrorResponse",
1574
+ '404': "ErrorResponse",
1575
+ }
1576
+ response_data = self.api_client.call_api(
1577
+ *_param,
1578
+ _request_timeout=_request_timeout
1579
+ )
1580
+ response_data.read()
1581
+ return self.api_client.response_deserialize(
1582
+ response_data=response_data,
1583
+ response_types_map=_response_types_map,
1584
+ )
1585
+
1586
+
1587
+ @validate_call
1588
+ def upload_execution_files_without_preload_content(
1589
+ self,
1590
+ id: Annotated[StrictStr, Field(description="The ID of the execution")],
1591
+ files: Annotated[Optional[List[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]], Field(description="Files to upload to the execution")] = None,
1592
+ _request_timeout: Union[
1593
+ None,
1594
+ Annotated[StrictFloat, Field(gt=0)],
1595
+ Tuple[
1596
+ Annotated[StrictFloat, Field(gt=0)],
1597
+ Annotated[StrictFloat, Field(gt=0)]
1598
+ ]
1599
+ ] = None,
1600
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1601
+ _content_type: Optional[StrictStr] = None,
1602
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1603
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1604
+ ) -> RESTResponseType:
1605
+ """Upload files to an execution
1606
+
1607
+
1608
+ :param id: The ID of the execution (required)
1609
+ :type id: str
1610
+ :param files: Files to upload to the execution
1611
+ :type files: List[bytearray]
1612
+ :param _request_timeout: timeout setting for this request. If one
1613
+ number provided, it will be total request
1614
+ timeout. It can also be a pair (tuple) of
1615
+ (connection, read) timeouts.
1616
+ :type _request_timeout: int, tuple(int, int), optional
1617
+ :param _request_auth: set to override the auth_settings for an a single
1618
+ request; this effectively ignores the
1619
+ authentication in the spec for a single request.
1620
+ :type _request_auth: dict, optional
1621
+ :param _content_type: force content-type for the request.
1622
+ :type _content_type: str, Optional
1623
+ :param _headers: set to override the headers for a single
1624
+ request; this effectively ignores the headers
1625
+ in the spec for a single request.
1626
+ :type _headers: dict, optional
1627
+ :param _host_index: set to override the host_index for a single
1628
+ request; this effectively ignores the host_index
1629
+ in the spec for a single request.
1630
+ :type _host_index: int, optional
1631
+ :return: Returns the result object.
1632
+ """ # noqa: E501
1633
+
1634
+ _param = self._upload_execution_files_serialize(
1635
+ id=id,
1636
+ files=files,
1637
+ _request_auth=_request_auth,
1638
+ _content_type=_content_type,
1639
+ _headers=_headers,
1640
+ _host_index=_host_index
1641
+ )
1642
+
1643
+ _response_types_map: Dict[str, Optional[str]] = {
1644
+ '200': "UploadExecutionFiles200Response",
1645
+ '400': "ErrorResponse",
1646
+ '401': "ErrorResponse",
1647
+ '404': "ErrorResponse",
1648
+ }
1649
+ response_data = self.api_client.call_api(
1650
+ *_param,
1651
+ _request_timeout=_request_timeout
1652
+ )
1653
+ return response_data.response
1654
+
1655
+
1656
+ def _upload_execution_files_serialize(
1657
+ self,
1658
+ id,
1659
+ files,
1660
+ _request_auth,
1661
+ _content_type,
1662
+ _headers,
1663
+ _host_index,
1664
+ ) -> RequestSerialized:
1665
+
1666
+ _host = None
1667
+
1668
+ _collection_formats: Dict[str, str] = {
1669
+ 'files': 'csv',
1670
+ }
1671
+
1672
+ _path_params: Dict[str, str] = {}
1673
+ _query_params: List[Tuple[str, str]] = []
1674
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1675
+ _form_params: List[Tuple[str, str]] = []
1676
+ _files: Dict[
1677
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1678
+ ] = {}
1679
+ _body_params: Optional[bytes] = None
1680
+
1681
+ # process the path parameters
1682
+ if id is not None:
1683
+ _path_params['id'] = id
1684
+ # process the query parameters
1685
+ # process the header parameters
1686
+ # process the form parameters
1687
+ if files is not None:
1688
+ _files['files'] = files
1689
+ # process the body parameter
1690
+
1691
+
1692
+ # set the HTTP header `Accept`
1693
+ if 'Accept' not in _header_params:
1694
+ _header_params['Accept'] = self.api_client.select_header_accept(
1695
+ [
1696
+ 'application/json'
1697
+ ]
1698
+ )
1699
+
1700
+ # set the HTTP header `Content-Type`
1701
+ if _content_type:
1702
+ _header_params['Content-Type'] = _content_type
1703
+ else:
1704
+ _default_content_type = (
1705
+ self.api_client.select_header_content_type(
1706
+ [
1707
+ 'multipart/form-data'
1708
+ ]
1709
+ )
1710
+ )
1711
+ if _default_content_type is not None:
1712
+ _header_params['Content-Type'] = _default_content_type
1713
+
1714
+ # authentication setting
1715
+ _auth_settings: List[str] = [
1716
+ 'ApiKeyAuth'
1717
+ ]
1718
+
1719
+ return self.api_client.param_serialize(
1720
+ method='POST',
1721
+ resource_path='/execution/{id}/files',
1722
+ path_params=_path_params,
1723
+ query_params=_query_params,
1724
+ header_params=_header_params,
1725
+ body=_body_params,
1726
+ post_params=_form_params,
1727
+ files=_files,
1728
+ auth_settings=_auth_settings,
1729
+ collection_formats=_collection_formats,
1730
+ _host=_host,
1731
+ _request_auth=_request_auth
1732
+ )
1733
+
1734
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asteroid-odyssey
3
- Version: 1.0.2
3
+ Version: 1.1.0
4
4
  Summary: A Python SDK for browser automation using Asteroid platform.
5
5
  Author-email: David Mlcoch <founders@asteroid.com>
6
6
  License-Expression: MIT
@@ -17,7 +17,6 @@ src/asteroid_odyssey/openapi_client/rest.py
17
17
  src/asteroid_odyssey/openapi_client/api/__init__.py
18
18
  src/asteroid_odyssey/openapi_client/api/api_api.py
19
19
  src/asteroid_odyssey/openapi_client/api/execution_api.py
20
- src/asteroid_odyssey/openapi_client/api/sdk_api.py
21
20
  src/asteroid_odyssey/openapi_client/models/__init__.py
22
21
  src/asteroid_odyssey/openapi_client/models/browser_session_recording_response.py
23
22
  src/asteroid_odyssey/openapi_client/models/error_response.py
@@ -40,7 +39,6 @@ test/test_execution_result_response.py
40
39
  test/test_execution_status_response.py
41
40
  test/test_health_check200_response.py
42
41
  test/test_health_check500_response.py
43
- test/test_sdk_api.py
44
42
  test/test_status.py
45
43
  test/test_structured_agent_execution_request.py
46
44
  test/test_upload_execution_files200_response.py
@@ -14,14 +14,14 @@
14
14
 
15
15
  import unittest
16
16
 
17
- from asteroid_odyssey.openapi_client.api.sdk_api import SDKApi
17
+ from asteroid_odyssey.openapi_client.api.execution_api import ExecutionApi
18
18
 
19
19
 
20
- class TestSDKApi(unittest.TestCase):
21
- """SDKApi unit test stubs"""
20
+ class TestExecutionApi(unittest.TestCase):
21
+ """ExecutionApi unit test stubs"""
22
22
 
23
23
  def setUp(self) -> None:
24
- self.api = SDKApi()
24
+ self.api = ExecutionApi()
25
25
 
26
26
  def tearDown(self) -> None:
27
27
  pass
@@ -61,6 +61,13 @@ class TestSDKApi(unittest.TestCase):
61
61
  """
62
62
  pass
63
63
 
64
+ def test_upload_execution_files(self) -> None:
65
+ """Test case for upload_execution_files
66
+
67
+ Upload files to an execution
68
+ """
69
+ pass
70
+
64
71
 
65
72
  if __name__ == '__main__':
66
73
  unittest.main()
@@ -1,335 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Asteroid Agents API
5
-
6
- Version 1 of the Asteroid Agents API
7
-
8
- The version of the OpenAPI document: v1.0.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
- import warnings
15
- from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
- from typing import Any, Dict, List, Optional, Tuple, Union
17
- from typing_extensions import Annotated
18
-
19
- from pydantic import Field, StrictBytes, StrictStr
20
- from typing import List, Optional, Tuple, Union
21
- from typing_extensions import Annotated
22
- from asteroid_odyssey.openapi_client.models.upload_execution_files200_response import UploadExecutionFiles200Response
23
-
24
- from asteroid_odyssey.openapi_client.api_client import ApiClient, RequestSerialized
25
- from asteroid_odyssey.openapi_client.api_response import ApiResponse
26
- from asteroid_odyssey.openapi_client.rest import RESTResponseType
27
-
28
-
29
- class ExecutionApi:
30
- """NOTE: This class is auto generated by OpenAPI Generator
31
- Ref: https://openapi-generator.tech
32
-
33
- Do not edit the class manually.
34
- """
35
-
36
- def __init__(self, api_client=None) -> None:
37
- if api_client is None:
38
- api_client = ApiClient.get_default()
39
- self.api_client = api_client
40
-
41
-
42
- @validate_call
43
- def upload_execution_files(
44
- self,
45
- id: Annotated[StrictStr, Field(description="The ID of the execution")],
46
- files: Annotated[Optional[List[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]], Field(description="Files to upload to the execution")] = None,
47
- _request_timeout: Union[
48
- None,
49
- Annotated[StrictFloat, Field(gt=0)],
50
- Tuple[
51
- Annotated[StrictFloat, Field(gt=0)],
52
- Annotated[StrictFloat, Field(gt=0)]
53
- ]
54
- ] = None,
55
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
56
- _content_type: Optional[StrictStr] = None,
57
- _headers: Optional[Dict[StrictStr, Any]] = None,
58
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
59
- ) -> UploadExecutionFiles200Response:
60
- """Upload files to an execution
61
-
62
-
63
- :param id: The ID of the execution (required)
64
- :type id: str
65
- :param files: Files to upload to the execution
66
- :type files: List[bytearray]
67
- :param _request_timeout: timeout setting for this request. If one
68
- number provided, it will be total request
69
- timeout. It can also be a pair (tuple) of
70
- (connection, read) timeouts.
71
- :type _request_timeout: int, tuple(int, int), optional
72
- :param _request_auth: set to override the auth_settings for an a single
73
- request; this effectively ignores the
74
- authentication in the spec for a single request.
75
- :type _request_auth: dict, optional
76
- :param _content_type: force content-type for the request.
77
- :type _content_type: str, Optional
78
- :param _headers: set to override the headers for a single
79
- request; this effectively ignores the headers
80
- in the spec for a single request.
81
- :type _headers: dict, optional
82
- :param _host_index: set to override the host_index for a single
83
- request; this effectively ignores the host_index
84
- in the spec for a single request.
85
- :type _host_index: int, optional
86
- :return: Returns the result object.
87
- """ # noqa: E501
88
-
89
- _param = self._upload_execution_files_serialize(
90
- id=id,
91
- files=files,
92
- _request_auth=_request_auth,
93
- _content_type=_content_type,
94
- _headers=_headers,
95
- _host_index=_host_index
96
- )
97
-
98
- _response_types_map: Dict[str, Optional[str]] = {
99
- '200': "UploadExecutionFiles200Response",
100
- '400': "ErrorResponse",
101
- '401': "ErrorResponse",
102
- '404': "ErrorResponse",
103
- }
104
- response_data = self.api_client.call_api(
105
- *_param,
106
- _request_timeout=_request_timeout
107
- )
108
- response_data.read()
109
- return self.api_client.response_deserialize(
110
- response_data=response_data,
111
- response_types_map=_response_types_map,
112
- ).data
113
-
114
-
115
- @validate_call
116
- def upload_execution_files_with_http_info(
117
- self,
118
- id: Annotated[StrictStr, Field(description="The ID of the execution")],
119
- files: Annotated[Optional[List[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]], Field(description="Files to upload to the execution")] = None,
120
- _request_timeout: Union[
121
- None,
122
- Annotated[StrictFloat, Field(gt=0)],
123
- Tuple[
124
- Annotated[StrictFloat, Field(gt=0)],
125
- Annotated[StrictFloat, Field(gt=0)]
126
- ]
127
- ] = None,
128
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
129
- _content_type: Optional[StrictStr] = None,
130
- _headers: Optional[Dict[StrictStr, Any]] = None,
131
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
132
- ) -> ApiResponse[UploadExecutionFiles200Response]:
133
- """Upload files to an execution
134
-
135
-
136
- :param id: The ID of the execution (required)
137
- :type id: str
138
- :param files: Files to upload to the execution
139
- :type files: List[bytearray]
140
- :param _request_timeout: timeout setting for this request. If one
141
- number provided, it will be total request
142
- timeout. It can also be a pair (tuple) of
143
- (connection, read) timeouts.
144
- :type _request_timeout: int, tuple(int, int), optional
145
- :param _request_auth: set to override the auth_settings for an a single
146
- request; this effectively ignores the
147
- authentication in the spec for a single request.
148
- :type _request_auth: dict, optional
149
- :param _content_type: force content-type for the request.
150
- :type _content_type: str, Optional
151
- :param _headers: set to override the headers for a single
152
- request; this effectively ignores the headers
153
- in the spec for a single request.
154
- :type _headers: dict, optional
155
- :param _host_index: set to override the host_index for a single
156
- request; this effectively ignores the host_index
157
- in the spec for a single request.
158
- :type _host_index: int, optional
159
- :return: Returns the result object.
160
- """ # noqa: E501
161
-
162
- _param = self._upload_execution_files_serialize(
163
- id=id,
164
- files=files,
165
- _request_auth=_request_auth,
166
- _content_type=_content_type,
167
- _headers=_headers,
168
- _host_index=_host_index
169
- )
170
-
171
- _response_types_map: Dict[str, Optional[str]] = {
172
- '200': "UploadExecutionFiles200Response",
173
- '400': "ErrorResponse",
174
- '401': "ErrorResponse",
175
- '404': "ErrorResponse",
176
- }
177
- response_data = self.api_client.call_api(
178
- *_param,
179
- _request_timeout=_request_timeout
180
- )
181
- response_data.read()
182
- return self.api_client.response_deserialize(
183
- response_data=response_data,
184
- response_types_map=_response_types_map,
185
- )
186
-
187
-
188
- @validate_call
189
- def upload_execution_files_without_preload_content(
190
- self,
191
- id: Annotated[StrictStr, Field(description="The ID of the execution")],
192
- files: Annotated[Optional[List[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]], Field(description="Files to upload to the execution")] = None,
193
- _request_timeout: Union[
194
- None,
195
- Annotated[StrictFloat, Field(gt=0)],
196
- Tuple[
197
- Annotated[StrictFloat, Field(gt=0)],
198
- Annotated[StrictFloat, Field(gt=0)]
199
- ]
200
- ] = None,
201
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
202
- _content_type: Optional[StrictStr] = None,
203
- _headers: Optional[Dict[StrictStr, Any]] = None,
204
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
205
- ) -> RESTResponseType:
206
- """Upload files to an execution
207
-
208
-
209
- :param id: The ID of the execution (required)
210
- :type id: str
211
- :param files: Files to upload to the execution
212
- :type files: List[bytearray]
213
- :param _request_timeout: timeout setting for this request. If one
214
- number provided, it will be total request
215
- timeout. It can also be a pair (tuple) of
216
- (connection, read) timeouts.
217
- :type _request_timeout: int, tuple(int, int), optional
218
- :param _request_auth: set to override the auth_settings for an a single
219
- request; this effectively ignores the
220
- authentication in the spec for a single request.
221
- :type _request_auth: dict, optional
222
- :param _content_type: force content-type for the request.
223
- :type _content_type: str, Optional
224
- :param _headers: set to override the headers for a single
225
- request; this effectively ignores the headers
226
- in the spec for a single request.
227
- :type _headers: dict, optional
228
- :param _host_index: set to override the host_index for a single
229
- request; this effectively ignores the host_index
230
- in the spec for a single request.
231
- :type _host_index: int, optional
232
- :return: Returns the result object.
233
- """ # noqa: E501
234
-
235
- _param = self._upload_execution_files_serialize(
236
- id=id,
237
- files=files,
238
- _request_auth=_request_auth,
239
- _content_type=_content_type,
240
- _headers=_headers,
241
- _host_index=_host_index
242
- )
243
-
244
- _response_types_map: Dict[str, Optional[str]] = {
245
- '200': "UploadExecutionFiles200Response",
246
- '400': "ErrorResponse",
247
- '401': "ErrorResponse",
248
- '404': "ErrorResponse",
249
- }
250
- response_data = self.api_client.call_api(
251
- *_param,
252
- _request_timeout=_request_timeout
253
- )
254
- return response_data.response
255
-
256
-
257
- def _upload_execution_files_serialize(
258
- self,
259
- id,
260
- files,
261
- _request_auth,
262
- _content_type,
263
- _headers,
264
- _host_index,
265
- ) -> RequestSerialized:
266
-
267
- _host = None
268
-
269
- _collection_formats: Dict[str, str] = {
270
- 'files': 'csv',
271
- }
272
-
273
- _path_params: Dict[str, str] = {}
274
- _query_params: List[Tuple[str, str]] = []
275
- _header_params: Dict[str, Optional[str]] = _headers or {}
276
- _form_params: List[Tuple[str, str]] = []
277
- _files: Dict[
278
- str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
279
- ] = {}
280
- _body_params: Optional[bytes] = None
281
-
282
- # process the path parameters
283
- if id is not None:
284
- _path_params['id'] = id
285
- # process the query parameters
286
- # process the header parameters
287
- # process the form parameters
288
- if files is not None:
289
- _files['files'] = files
290
- # process the body parameter
291
-
292
-
293
- # set the HTTP header `Accept`
294
- if 'Accept' not in _header_params:
295
- _header_params['Accept'] = self.api_client.select_header_accept(
296
- [
297
- 'application/json'
298
- ]
299
- )
300
-
301
- # set the HTTP header `Content-Type`
302
- if _content_type:
303
- _header_params['Content-Type'] = _content_type
304
- else:
305
- _default_content_type = (
306
- self.api_client.select_header_content_type(
307
- [
308
- 'multipart/form-data'
309
- ]
310
- )
311
- )
312
- if _default_content_type is not None:
313
- _header_params['Content-Type'] = _default_content_type
314
-
315
- # authentication setting
316
- _auth_settings: List[str] = [
317
- 'ApiKeyAuth'
318
- ]
319
-
320
- return self.api_client.param_serialize(
321
- method='POST',
322
- resource_path='/execution/{id}/files',
323
- path_params=_path_params,
324
- query_params=_query_params,
325
- header_params=_header_params,
326
- body=_body_params,
327
- post_params=_form_params,
328
- files=_files,
329
- auth_settings=_auth_settings,
330
- collection_formats=_collection_formats,
331
- _host=_host,
332
- _request_auth=_request_auth
333
- )
334
-
335
-
@@ -1,38 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Asteroid Agents API
5
-
6
- Version 1 of the Asteroid Agents API
7
-
8
- The version of the OpenAPI document: v1.0.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- import unittest
16
-
17
- from asteroid_odyssey.openapi_client.api.execution_api import ExecutionApi
18
-
19
-
20
- class TestExecutionApi(unittest.TestCase):
21
- """ExecutionApi unit test stubs"""
22
-
23
- def setUp(self) -> None:
24
- self.api = ExecutionApi()
25
-
26
- def tearDown(self) -> None:
27
- pass
28
-
29
- def test_upload_execution_files(self) -> None:
30
- """Test case for upload_execution_files
31
-
32
- Upload files to an execution
33
- """
34
- pass
35
-
36
-
37
- if __name__ == '__main__':
38
- unittest.main()