asteroid-odyssey 1.3.0__tar.gz → 1.3.2__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.
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/PKG-INFO +1 -1
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/pyproject.toml +1 -1
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/__init__.py +21 -1
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/__init__.py +2 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/__init__.py +1 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/agent_profile.py +11 -1
- asteroid_odyssey-1.3.2/src/asteroid_odyssey/agents_v1_gen/models/cookie.py +113 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/create_agent_profile_request.py +12 -2
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/update_agent_profile_request.py +14 -2
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/__init__.py +8 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/configuration.py +2 -2
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/__init__.py +4 -0
- asteroid_odyssey-1.3.2/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_status_changed_payload.py +112 -0
- asteroid_odyssey-1.3.2/src/asteroid_odyssey/agents_v2_gen/models/execution_awaiting_confirmation_payload.py +87 -0
- asteroid_odyssey-1.3.2/src/asteroid_odyssey/agents_v2_gen/models/execution_completed_payload.py +105 -0
- asteroid_odyssey-1.3.2/src/asteroid_odyssey/agents_v2_gen/models/execution_failed_payload.py +87 -0
- asteroid_odyssey-1.3.2/src/asteroid_odyssey/agents_v2_gen/models/execution_paused_payload.py +87 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/client.py +231 -35
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey.egg-info/PKG-INFO +1 -1
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey.egg-info/SOURCES.txt +5 -0
- asteroid_odyssey-1.3.0/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_status_changed_payload.py +0 -88
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/README.md +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/setup.cfg +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/api/__init__.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/api/agent_profile_api.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/api/api_api.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/api/execution_api.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/api_client.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/api_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/configuration.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/exceptions.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/browser_session_recording_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/country_code.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/credential.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/delete_agent_profile200_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/error_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/execution_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/execution_result.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/execution_result_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/execution_status_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/health_check200_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/health_check500_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/proxy_type.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/status.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/structured_agent_execution_request.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/models/upload_execution_files200_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/py.typed +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/rest.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/api/__init__.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/api/execution_api.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/api_client.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/api_response.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/exceptions.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_completed.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_failed.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_action_started.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_generic.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_status_changed.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_step_completed.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_step_started.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_terminal.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_transitioned_node.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/activity_payload_union_user_message_received.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/error.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_action_completed_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_action_failed_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_action_started_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_generic_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_payload_union.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_step_completed_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_step_started_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_transitioned_node_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_activity_user_message_received_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_status.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_terminal_payload.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/execution_user_messages_add_text_body.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/models/versions.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/py.typed +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/rest.py +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey.egg-info/dependency_links.txt +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey.egg-info/requires.txt +0 -0
- {asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey.egg-info/top_level.txt +0 -0
|
@@ -7,9 +7,19 @@ from .client import (
|
|
|
7
7
|
wait_for_execution_result,
|
|
8
8
|
upload_execution_files,
|
|
9
9
|
get_browser_session_recording,
|
|
10
|
+
get_agent_profiles,
|
|
11
|
+
get_agent_profile,
|
|
12
|
+
create_agent_profile,
|
|
13
|
+
update_agent_profile,
|
|
14
|
+
delete_agent_profile,
|
|
15
|
+
get_last_n_execution_activities,
|
|
16
|
+
add_message_to_execution,
|
|
17
|
+
wait_for_agent_interaction,
|
|
18
|
+
get_credentials_public_key,
|
|
10
19
|
AsteroidAPIError,
|
|
11
20
|
ExecutionError,
|
|
12
|
-
TimeoutError
|
|
21
|
+
TimeoutError,
|
|
22
|
+
AgentInteractionResult
|
|
13
23
|
)
|
|
14
24
|
from .agents_v1_gen import ExecutionResult
|
|
15
25
|
|
|
@@ -22,8 +32,18 @@ __all__ = [
|
|
|
22
32
|
'wait_for_execution_result',
|
|
23
33
|
'upload_execution_files',
|
|
24
34
|
'get_browser_session_recording',
|
|
35
|
+
'get_agent_profiles',
|
|
36
|
+
'get_agent_profile',
|
|
37
|
+
'create_agent_profile',
|
|
38
|
+
'update_agent_profile',
|
|
39
|
+
'delete_agent_profile',
|
|
40
|
+
'get_last_n_execution_activities',
|
|
41
|
+
'add_message_to_execution',
|
|
42
|
+
'wait_for_agent_interaction',
|
|
43
|
+
'get_credentials_public_key',
|
|
25
44
|
'AsteroidAPIError',
|
|
26
45
|
'ExecutionError',
|
|
27
46
|
'TimeoutError',
|
|
47
|
+
'AgentInteractionResult',
|
|
28
48
|
'ExecutionResult'
|
|
29
49
|
]
|
{asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v1_gen/__init__.py
RENAMED
|
@@ -32,6 +32,7 @@ __all__ = [
|
|
|
32
32
|
"ApiException",
|
|
33
33
|
"AgentProfile",
|
|
34
34
|
"BrowserSessionRecordingResponse",
|
|
35
|
+
"Cookie",
|
|
35
36
|
"CountryCode",
|
|
36
37
|
"CreateAgentProfileRequest",
|
|
37
38
|
"Credential",
|
|
@@ -69,6 +70,7 @@ from asteroid_odyssey.agents_v1_gen.exceptions import ApiException as ApiExcepti
|
|
|
69
70
|
# import models into sdk package
|
|
70
71
|
from asteroid_odyssey.agents_v1_gen.models.agent_profile import AgentProfile as AgentProfile
|
|
71
72
|
from asteroid_odyssey.agents_v1_gen.models.browser_session_recording_response import BrowserSessionRecordingResponse as BrowserSessionRecordingResponse
|
|
73
|
+
from asteroid_odyssey.agents_v1_gen.models.cookie import Cookie as Cookie
|
|
72
74
|
from asteroid_odyssey.agents_v1_gen.models.country_code import CountryCode as CountryCode
|
|
73
75
|
from asteroid_odyssey.agents_v1_gen.models.create_agent_profile_request import CreateAgentProfileRequest as CreateAgentProfileRequest
|
|
74
76
|
from asteroid_odyssey.agents_v1_gen.models.credential import Credential as Credential
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
# import models into model package
|
|
17
17
|
from asteroid_odyssey.agents_v1_gen.models.agent_profile import AgentProfile
|
|
18
18
|
from asteroid_odyssey.agents_v1_gen.models.browser_session_recording_response import BrowserSessionRecordingResponse
|
|
19
|
+
from asteroid_odyssey.agents_v1_gen.models.cookie import Cookie
|
|
19
20
|
from asteroid_odyssey.agents_v1_gen.models.country_code import CountryCode
|
|
20
21
|
from asteroid_odyssey.agents_v1_gen.models.create_agent_profile_request import CreateAgentProfileRequest
|
|
21
22
|
from asteroid_odyssey.agents_v1_gen.models.credential import Credential
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from datetime import datetime
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from asteroid_odyssey.agents_v1_gen.models.cookie import Cookie
|
|
23
24
|
from asteroid_odyssey.agents_v1_gen.models.country_code import CountryCode
|
|
24
25
|
from asteroid_odyssey.agents_v1_gen.models.credential import Credential
|
|
25
26
|
from asteroid_odyssey.agents_v1_gen.models.proxy_type import ProxyType
|
|
@@ -39,9 +40,10 @@ class AgentProfile(BaseModel):
|
|
|
39
40
|
captcha_solver_active: StrictBool = Field(description="Whether the captcha solver is active for this profile")
|
|
40
41
|
sticky_ip: StrictBool = Field(description="Whether the same IP address should be used for all executions of this profile")
|
|
41
42
|
credentials: List[Credential] = Field(description="List of credentials associated with this agent profile")
|
|
43
|
+
cookies: List[Cookie] = Field(description="List of cookies associated with this agent profile")
|
|
42
44
|
created_at: datetime = Field(description="The date and time the agent profile was created")
|
|
43
45
|
updated_at: datetime = Field(description="The last update time of the agent profile")
|
|
44
|
-
__properties: ClassVar[List[str]] = ["id", "name", "description", "organization_id", "proxy_cc", "proxy_type", "captcha_solver_active", "sticky_ip", "credentials", "created_at", "updated_at"]
|
|
46
|
+
__properties: ClassVar[List[str]] = ["id", "name", "description", "organization_id", "proxy_cc", "proxy_type", "captcha_solver_active", "sticky_ip", "credentials", "cookies", "created_at", "updated_at"]
|
|
45
47
|
|
|
46
48
|
model_config = ConfigDict(
|
|
47
49
|
populate_by_name=True,
|
|
@@ -89,6 +91,13 @@ class AgentProfile(BaseModel):
|
|
|
89
91
|
if _item_credentials:
|
|
90
92
|
_items.append(_item_credentials.to_dict())
|
|
91
93
|
_dict['credentials'] = _items
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of each item in cookies (list)
|
|
95
|
+
_items = []
|
|
96
|
+
if self.cookies:
|
|
97
|
+
for _item_cookies in self.cookies:
|
|
98
|
+
if _item_cookies:
|
|
99
|
+
_items.append(_item_cookies.to_dict())
|
|
100
|
+
_dict['cookies'] = _items
|
|
92
101
|
return _dict
|
|
93
102
|
|
|
94
103
|
@classmethod
|
|
@@ -110,6 +119,7 @@ class AgentProfile(BaseModel):
|
|
|
110
119
|
"captcha_solver_active": obj.get("captcha_solver_active"),
|
|
111
120
|
"sticky_ip": obj.get("sticky_ip"),
|
|
112
121
|
"credentials": [Credential.from_dict(_item) for _item in obj["credentials"]] if obj.get("credentials") is not None else None,
|
|
122
|
+
"cookies": [Cookie.from_dict(_item) for _item in obj["cookies"]] if obj.get("cookies") is not None else None,
|
|
113
123
|
"created_at": obj.get("created_at"),
|
|
114
124
|
"updated_at": obj.get("updated_at")
|
|
115
125
|
})
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class Cookie(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Cookie
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: Optional[StrictStr] = Field(default=None, description="Unique identifier for the cookie")
|
|
31
|
+
name: StrictStr = Field(description="Display name for the cookie")
|
|
32
|
+
key: StrictStr = Field(description="The cookie name/key")
|
|
33
|
+
value: StrictStr = Field(description="The cookie value")
|
|
34
|
+
expiry: Optional[datetime] = Field(default=None, description="When the cookie expires (optional)")
|
|
35
|
+
domain: StrictStr = Field(description="The domain for which the cookie is valid")
|
|
36
|
+
secure: StrictBool = Field(description="Whether the cookie should only be sent over HTTPS")
|
|
37
|
+
same_site: StrictStr = Field(description="SameSite attribute for the cookie")
|
|
38
|
+
http_only: StrictBool = Field(description="Whether the cookie should be accessible only via HTTP(S)")
|
|
39
|
+
created_at: datetime = Field(description="When the cookie was created")
|
|
40
|
+
__properties: ClassVar[List[str]] = ["id", "name", "key", "value", "expiry", "domain", "secure", "same_site", "http_only", "created_at"]
|
|
41
|
+
|
|
42
|
+
@field_validator('same_site')
|
|
43
|
+
def same_site_validate_enum(cls, value):
|
|
44
|
+
"""Validates the enum"""
|
|
45
|
+
if value not in set(['Strict', 'Lax', 'None']):
|
|
46
|
+
raise ValueError("must be one of enum values ('Strict', 'Lax', 'None')")
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
populate_by_name=True,
|
|
51
|
+
validate_assignment=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def to_str(self) -> str:
|
|
57
|
+
"""Returns the string representation of the model using alias"""
|
|
58
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
59
|
+
|
|
60
|
+
def to_json(self) -> str:
|
|
61
|
+
"""Returns the JSON representation of the model using alias"""
|
|
62
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
63
|
+
return json.dumps(self.to_dict())
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
67
|
+
"""Create an instance of Cookie from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
|
72
|
+
|
|
73
|
+
This has the following differences from calling pydantic's
|
|
74
|
+
`self.model_dump(by_alias=True)`:
|
|
75
|
+
|
|
76
|
+
* `None` is only added to the output dict for nullable fields that
|
|
77
|
+
were set at model initialization. Other fields with value `None`
|
|
78
|
+
are ignored.
|
|
79
|
+
"""
|
|
80
|
+
excluded_fields: Set[str] = set([
|
|
81
|
+
])
|
|
82
|
+
|
|
83
|
+
_dict = self.model_dump(
|
|
84
|
+
by_alias=True,
|
|
85
|
+
exclude=excluded_fields,
|
|
86
|
+
exclude_none=True,
|
|
87
|
+
)
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of Cookie from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate({
|
|
100
|
+
"id": obj.get("id"),
|
|
101
|
+
"name": obj.get("name"),
|
|
102
|
+
"key": obj.get("key"),
|
|
103
|
+
"value": obj.get("value"),
|
|
104
|
+
"expiry": obj.get("expiry"),
|
|
105
|
+
"domain": obj.get("domain"),
|
|
106
|
+
"secure": obj.get("secure"),
|
|
107
|
+
"same_site": obj.get("same_site"),
|
|
108
|
+
"http_only": obj.get("http_only"),
|
|
109
|
+
"created_at": obj.get("created_at")
|
|
110
|
+
})
|
|
111
|
+
return _obj
|
|
112
|
+
|
|
113
|
+
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
22
|
from typing_extensions import Annotated
|
|
23
|
+
from asteroid_odyssey.agents_v1_gen.models.cookie import Cookie
|
|
23
24
|
from asteroid_odyssey.agents_v1_gen.models.country_code import CountryCode
|
|
24
25
|
from asteroid_odyssey.agents_v1_gen.models.credential import Credential
|
|
25
26
|
from asteroid_odyssey.agents_v1_gen.models.proxy_type import ProxyType
|
|
@@ -38,7 +39,8 @@ class CreateAgentProfileRequest(BaseModel):
|
|
|
38
39
|
captcha_solver_active: StrictBool = Field(description="Whether the captcha solver should be active for this profile")
|
|
39
40
|
sticky_ip: StrictBool = Field(description="Whether the same IP address should be used for all executions of this profile")
|
|
40
41
|
credentials: List[Credential] = Field(description="Optional list of credentials to create with the profile")
|
|
41
|
-
|
|
42
|
+
cookies: List[Cookie] = Field(description="Optional list of cookies to create with the profile")
|
|
43
|
+
__properties: ClassVar[List[str]] = ["name", "description", "organization_id", "proxy_cc", "proxy_type", "captcha_solver_active", "sticky_ip", "credentials", "cookies"]
|
|
42
44
|
|
|
43
45
|
model_config = ConfigDict(
|
|
44
46
|
populate_by_name=True,
|
|
@@ -86,6 +88,13 @@ class CreateAgentProfileRequest(BaseModel):
|
|
|
86
88
|
if _item_credentials:
|
|
87
89
|
_items.append(_item_credentials.to_dict())
|
|
88
90
|
_dict['credentials'] = _items
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of each item in cookies (list)
|
|
92
|
+
_items = []
|
|
93
|
+
if self.cookies:
|
|
94
|
+
for _item_cookies in self.cookies:
|
|
95
|
+
if _item_cookies:
|
|
96
|
+
_items.append(_item_cookies.to_dict())
|
|
97
|
+
_dict['cookies'] = _items
|
|
89
98
|
return _dict
|
|
90
99
|
|
|
91
100
|
@classmethod
|
|
@@ -105,7 +114,8 @@ class CreateAgentProfileRequest(BaseModel):
|
|
|
105
114
|
"proxy_type": obj.get("proxy_type"),
|
|
106
115
|
"captcha_solver_active": obj.get("captcha_solver_active") if obj.get("captcha_solver_active") is not None else False,
|
|
107
116
|
"sticky_ip": obj.get("sticky_ip") if obj.get("sticky_ip") is not None else False,
|
|
108
|
-
"credentials": [Credential.from_dict(_item) for _item in obj["credentials"]] if obj.get("credentials") is not None else None
|
|
117
|
+
"credentials": [Credential.from_dict(_item) for _item in obj["credentials"]] if obj.get("credentials") is not None else None,
|
|
118
|
+
"cookies": [Cookie.from_dict(_item) for _item in obj["cookies"]] if obj.get("cookies") is not None else None
|
|
109
119
|
})
|
|
110
120
|
return _obj
|
|
111
121
|
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from typing_extensions import Annotated
|
|
23
|
+
from asteroid_odyssey.agents_v1_gen.models.cookie import Cookie
|
|
23
24
|
from asteroid_odyssey.agents_v1_gen.models.country_code import CountryCode
|
|
24
25
|
from asteroid_odyssey.agents_v1_gen.models.credential import Credential
|
|
25
26
|
from asteroid_odyssey.agents_v1_gen.models.proxy_type import ProxyType
|
|
@@ -38,7 +39,9 @@ class UpdateAgentProfileRequest(BaseModel):
|
|
|
38
39
|
sticky_ip: Optional[StrictBool] = Field(default=None, description="Whether the same IP address should be used for all executions of this profile")
|
|
39
40
|
credentials_to_add: Optional[List[Credential]] = Field(default=None, description="List of credentials to add to the profile")
|
|
40
41
|
credentials_to_delete: Optional[List[StrictStr]] = Field(default=None, description="List of credential IDs to delete from the profile")
|
|
41
|
-
|
|
42
|
+
cookies_to_add: Optional[List[Cookie]] = Field(default=None, description="List of cookies to add to the profile")
|
|
43
|
+
cookies_to_delete: Optional[List[StrictStr]] = Field(default=None, description="List of cookie IDs to delete from the profile")
|
|
44
|
+
__properties: ClassVar[List[str]] = ["name", "description", "proxy_cc", "proxy_type", "captcha_solver_active", "sticky_ip", "credentials_to_add", "credentials_to_delete", "cookies_to_add", "cookies_to_delete"]
|
|
42
45
|
|
|
43
46
|
model_config = ConfigDict(
|
|
44
47
|
populate_by_name=True,
|
|
@@ -86,6 +89,13 @@ class UpdateAgentProfileRequest(BaseModel):
|
|
|
86
89
|
if _item_credentials_to_add:
|
|
87
90
|
_items.append(_item_credentials_to_add.to_dict())
|
|
88
91
|
_dict['credentials_to_add'] = _items
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of each item in cookies_to_add (list)
|
|
93
|
+
_items = []
|
|
94
|
+
if self.cookies_to_add:
|
|
95
|
+
for _item_cookies_to_add in self.cookies_to_add:
|
|
96
|
+
if _item_cookies_to_add:
|
|
97
|
+
_items.append(_item_cookies_to_add.to_dict())
|
|
98
|
+
_dict['cookies_to_add'] = _items
|
|
89
99
|
return _dict
|
|
90
100
|
|
|
91
101
|
@classmethod
|
|
@@ -105,7 +115,9 @@ class UpdateAgentProfileRequest(BaseModel):
|
|
|
105
115
|
"captcha_solver_active": obj.get("captcha_solver_active"),
|
|
106
116
|
"sticky_ip": obj.get("sticky_ip"),
|
|
107
117
|
"credentials_to_add": [Credential.from_dict(_item) for _item in obj["credentials_to_add"]] if obj.get("credentials_to_add") is not None else None,
|
|
108
|
-
"credentials_to_delete": obj.get("credentials_to_delete")
|
|
118
|
+
"credentials_to_delete": obj.get("credentials_to_delete"),
|
|
119
|
+
"cookies_to_add": [Cookie.from_dict(_item) for _item in obj["cookies_to_add"]] if obj.get("cookies_to_add") is not None else None,
|
|
120
|
+
"cookies_to_delete": obj.get("cookies_to_delete")
|
|
109
121
|
})
|
|
110
122
|
return _obj
|
|
111
123
|
|
{asteroid_odyssey-1.3.0 → asteroid_odyssey-1.3.2}/src/asteroid_odyssey/agents_v2_gen/__init__.py
RENAMED
|
@@ -50,6 +50,10 @@ __all__ = [
|
|
|
50
50
|
"ExecutionActivityStepStartedPayload",
|
|
51
51
|
"ExecutionActivityTransitionedNodePayload",
|
|
52
52
|
"ExecutionActivityUserMessageReceivedPayload",
|
|
53
|
+
"ExecutionAwaitingConfirmationPayload",
|
|
54
|
+
"ExecutionCompletedPayload",
|
|
55
|
+
"ExecutionFailedPayload",
|
|
56
|
+
"ExecutionPausedPayload",
|
|
53
57
|
"ExecutionStatus",
|
|
54
58
|
"ExecutionTerminalPayload",
|
|
55
59
|
"ExecutionUserMessagesAddTextBody",
|
|
@@ -93,6 +97,10 @@ from asteroid_odyssey.agents_v2_gen.models.execution_activity_step_completed_pay
|
|
|
93
97
|
from asteroid_odyssey.agents_v2_gen.models.execution_activity_step_started_payload import ExecutionActivityStepStartedPayload as ExecutionActivityStepStartedPayload
|
|
94
98
|
from asteroid_odyssey.agents_v2_gen.models.execution_activity_transitioned_node_payload import ExecutionActivityTransitionedNodePayload as ExecutionActivityTransitionedNodePayload
|
|
95
99
|
from asteroid_odyssey.agents_v2_gen.models.execution_activity_user_message_received_payload import ExecutionActivityUserMessageReceivedPayload as ExecutionActivityUserMessageReceivedPayload
|
|
100
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_awaiting_confirmation_payload import ExecutionAwaitingConfirmationPayload as ExecutionAwaitingConfirmationPayload
|
|
101
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_completed_payload import ExecutionCompletedPayload as ExecutionCompletedPayload
|
|
102
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_failed_payload import ExecutionFailedPayload as ExecutionFailedPayload
|
|
103
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_paused_payload import ExecutionPausedPayload as ExecutionPausedPayload
|
|
96
104
|
from asteroid_odyssey.agents_v2_gen.models.execution_status import ExecutionStatus as ExecutionStatus
|
|
97
105
|
from asteroid_odyssey.agents_v2_gen.models.execution_terminal_payload import ExecutionTerminalPayload as ExecutionTerminalPayload
|
|
98
106
|
from asteroid_odyssey.agents_v2_gen.models.execution_user_messages_add_text_body import ExecutionUserMessagesAddTextBody as ExecutionUserMessagesAddTextBody
|
|
@@ -209,7 +209,7 @@ conf = asteroid_odyssey.agents_v2_gen.Configuration(
|
|
|
209
209
|
) -> None:
|
|
210
210
|
"""Constructor
|
|
211
211
|
"""
|
|
212
|
-
self._base_path = "https://odyssey.asteroid.ai/agents/
|
|
212
|
+
self._base_path = "https://odyssey.asteroid.ai/agents/v2" if host is None else host
|
|
213
213
|
"""Default Base url
|
|
214
214
|
"""
|
|
215
215
|
self.server_index = 0 if server_index is None and host is None else server_index
|
|
@@ -546,7 +546,7 @@ conf = asteroid_odyssey.agents_v2_gen.Configuration(
|
|
|
546
546
|
'variables': {
|
|
547
547
|
'version': {
|
|
548
548
|
'description': "No description provided",
|
|
549
|
-
'default_value': "",
|
|
549
|
+
'default_value': "v2",
|
|
550
550
|
'enum_values': [
|
|
551
551
|
"frontend",
|
|
552
552
|
"v2"
|
|
@@ -36,6 +36,10 @@ from asteroid_odyssey.agents_v2_gen.models.execution_activity_step_completed_pay
|
|
|
36
36
|
from asteroid_odyssey.agents_v2_gen.models.execution_activity_step_started_payload import ExecutionActivityStepStartedPayload
|
|
37
37
|
from asteroid_odyssey.agents_v2_gen.models.execution_activity_transitioned_node_payload import ExecutionActivityTransitionedNodePayload
|
|
38
38
|
from asteroid_odyssey.agents_v2_gen.models.execution_activity_user_message_received_payload import ExecutionActivityUserMessageReceivedPayload
|
|
39
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_awaiting_confirmation_payload import ExecutionAwaitingConfirmationPayload
|
|
40
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_completed_payload import ExecutionCompletedPayload
|
|
41
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_failed_payload import ExecutionFailedPayload
|
|
42
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_paused_payload import ExecutionPausedPayload
|
|
39
43
|
from asteroid_odyssey.agents_v2_gen.models.execution_status import ExecutionStatus
|
|
40
44
|
from asteroid_odyssey.agents_v2_gen.models.execution_terminal_payload import ExecutionTerminalPayload
|
|
41
45
|
from asteroid_odyssey.agents_v2_gen.models.execution_user_messages_add_text_body import ExecutionUserMessagesAddTextBody
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Agent Service
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v2
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_awaiting_confirmation_payload import ExecutionAwaitingConfirmationPayload
|
|
23
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_completed_payload import ExecutionCompletedPayload
|
|
24
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_failed_payload import ExecutionFailedPayload
|
|
25
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_paused_payload import ExecutionPausedPayload
|
|
26
|
+
from asteroid_odyssey.agents_v2_gen.models.execution_status import ExecutionStatus
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class ExecutionActivityStatusChangedPayload(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
ExecutionActivityStatusChangedPayload
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
awaiting_confirmation_payload: Optional[ExecutionAwaitingConfirmationPayload] = Field(default=None, alias="awaitingConfirmationPayload")
|
|
35
|
+
completed_payload: Optional[ExecutionCompletedPayload] = Field(default=None, alias="completedPayload")
|
|
36
|
+
failed_payload: Optional[ExecutionFailedPayload] = Field(default=None, alias="failedPayload")
|
|
37
|
+
paused_payload: Optional[ExecutionPausedPayload] = Field(default=None, alias="pausedPayload")
|
|
38
|
+
status: ExecutionStatus
|
|
39
|
+
__properties: ClassVar[List[str]] = ["awaitingConfirmationPayload", "completedPayload", "failedPayload", "pausedPayload", "status"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ExecutionActivityStatusChangedPayload from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of awaiting_confirmation_payload
|
|
81
|
+
if self.awaiting_confirmation_payload:
|
|
82
|
+
_dict['awaitingConfirmationPayload'] = self.awaiting_confirmation_payload.to_dict()
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of completed_payload
|
|
84
|
+
if self.completed_payload:
|
|
85
|
+
_dict['completedPayload'] = self.completed_payload.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of failed_payload
|
|
87
|
+
if self.failed_payload:
|
|
88
|
+
_dict['failedPayload'] = self.failed_payload.to_dict()
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of paused_payload
|
|
90
|
+
if self.paused_payload:
|
|
91
|
+
_dict['pausedPayload'] = self.paused_payload.to_dict()
|
|
92
|
+
return _dict
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
96
|
+
"""Create an instance of ExecutionActivityStatusChangedPayload from a dict"""
|
|
97
|
+
if obj is None:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
if not isinstance(obj, dict):
|
|
101
|
+
return cls.model_validate(obj)
|
|
102
|
+
|
|
103
|
+
_obj = cls.model_validate({
|
|
104
|
+
"awaitingConfirmationPayload": ExecutionAwaitingConfirmationPayload.from_dict(obj["awaitingConfirmationPayload"]) if obj.get("awaitingConfirmationPayload") is not None else None,
|
|
105
|
+
"completedPayload": ExecutionCompletedPayload.from_dict(obj["completedPayload"]) if obj.get("completedPayload") is not None else None,
|
|
106
|
+
"failedPayload": ExecutionFailedPayload.from_dict(obj["failedPayload"]) if obj.get("failedPayload") is not None else None,
|
|
107
|
+
"pausedPayload": ExecutionPausedPayload.from_dict(obj["pausedPayload"]) if obj.get("pausedPayload") is not None else None,
|
|
108
|
+
"status": obj.get("status")
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Agent Service
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v2
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ExecutionAwaitingConfirmationPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
ExecutionAwaitingConfirmationPayload
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
reason: StrictStr
|
|
30
|
+
__properties: ClassVar[List[str]] = ["reason"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of ExecutionAwaitingConfirmationPayload from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of ExecutionAwaitingConfirmationPayload from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"reason": obj.get("reason")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|