anchorbrowser 0.7.4__py3-none-any.whl → 0.8.0__py3-none-any.whl
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.
- anchorbrowser/_base_client.py +5 -2
- anchorbrowser/_compat.py +3 -3
- anchorbrowser/_utils/_json.py +35 -0
- anchorbrowser/_version.py +1 -1
- anchorbrowser/resources/agent.py +2 -0
- {anchorbrowser-0.7.4.dist-info → anchorbrowser-0.8.0.dist-info}/METADATA +1 -1
- {anchorbrowser-0.7.4.dist-info → anchorbrowser-0.8.0.dist-info}/RECORD +9 -8
- {anchorbrowser-0.7.4.dist-info → anchorbrowser-0.8.0.dist-info}/WHEEL +0 -0
- {anchorbrowser-0.7.4.dist-info → anchorbrowser-0.8.0.dist-info}/licenses/LICENSE +0 -0
anchorbrowser/_base_client.py
CHANGED
|
@@ -86,6 +86,7 @@ from ._exceptions import (
|
|
|
86
86
|
APIConnectionError,
|
|
87
87
|
APIResponseValidationError,
|
|
88
88
|
)
|
|
89
|
+
from ._utils._json import openapi_dumps
|
|
89
90
|
|
|
90
91
|
log: logging.Logger = logging.getLogger(__name__)
|
|
91
92
|
|
|
@@ -554,8 +555,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
554
555
|
kwargs["content"] = options.content
|
|
555
556
|
elif isinstance(json_data, bytes):
|
|
556
557
|
kwargs["content"] = json_data
|
|
557
|
-
|
|
558
|
-
|
|
558
|
+
elif not files:
|
|
559
|
+
# Don't set content when JSON is sent as multipart/form-data,
|
|
560
|
+
# since httpx's content param overrides other body arguments
|
|
561
|
+
kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None
|
|
559
562
|
kwargs["files"] = files
|
|
560
563
|
else:
|
|
561
564
|
headers.pop("Content-Type", None)
|
anchorbrowser/_compat.py
CHANGED
|
@@ -139,6 +139,7 @@ def model_dump(
|
|
|
139
139
|
exclude_defaults: bool = False,
|
|
140
140
|
warnings: bool = True,
|
|
141
141
|
mode: Literal["json", "python"] = "python",
|
|
142
|
+
by_alias: bool | None = None,
|
|
142
143
|
) -> dict[str, Any]:
|
|
143
144
|
if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
|
|
144
145
|
return model.model_dump(
|
|
@@ -148,13 +149,12 @@ def model_dump(
|
|
|
148
149
|
exclude_defaults=exclude_defaults,
|
|
149
150
|
# warnings are not supported in Pydantic v1
|
|
150
151
|
warnings=True if PYDANTIC_V1 else warnings,
|
|
152
|
+
by_alias=by_alias,
|
|
151
153
|
)
|
|
152
154
|
return cast(
|
|
153
155
|
"dict[str, Any]",
|
|
154
156
|
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
|
|
155
|
-
exclude=exclude,
|
|
156
|
-
exclude_unset=exclude_unset,
|
|
157
|
-
exclude_defaults=exclude_defaults,
|
|
157
|
+
exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias)
|
|
158
158
|
),
|
|
159
159
|
)
|
|
160
160
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Any
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing_extensions import override
|
|
5
|
+
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
from .._compat import model_dump
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def openapi_dumps(obj: Any) -> bytes:
|
|
12
|
+
"""
|
|
13
|
+
Serialize an object to UTF-8 encoded JSON bytes.
|
|
14
|
+
|
|
15
|
+
Extends the standard json.dumps with support for additional types
|
|
16
|
+
commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
|
|
17
|
+
"""
|
|
18
|
+
return json.dumps(
|
|
19
|
+
obj,
|
|
20
|
+
cls=_CustomEncoder,
|
|
21
|
+
# Uses the same defaults as httpx's JSON serialization
|
|
22
|
+
ensure_ascii=False,
|
|
23
|
+
separators=(",", ":"),
|
|
24
|
+
allow_nan=False,
|
|
25
|
+
).encode()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class _CustomEncoder(json.JSONEncoder):
|
|
29
|
+
@override
|
|
30
|
+
def default(self, o: Any) -> Any:
|
|
31
|
+
if isinstance(o, datetime):
|
|
32
|
+
return o.isoformat()
|
|
33
|
+
if isinstance(o, pydantic.BaseModel):
|
|
34
|
+
return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
|
|
35
|
+
return super().default(o)
|
anchorbrowser/_version.py
CHANGED
anchorbrowser/resources/agent.py
CHANGED
|
@@ -63,6 +63,8 @@ class AgentResource(SyncAPIResource):
|
|
|
63
63
|
Returns:
|
|
64
64
|
str: The result of the AI agent task execution.
|
|
65
65
|
"""
|
|
66
|
+
if session_id and session_options:
|
|
67
|
+
raise ValueError("session_id and session_options cannot be provided together")
|
|
66
68
|
if session_id:
|
|
67
69
|
retrieved_session = self._client.sessions.retrieve(session_id)
|
|
68
70
|
if not retrieved_session or not retrieved_session or not retrieved_session.session_id:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: anchorbrowser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: The official Python library for the anchorbrowser API
|
|
5
5
|
Project-URL: Homepage, https://github.com/anchorbrowser/AnchorBrowser-SDK-Python
|
|
6
6
|
Project-URL: Repository, https://github.com/anchorbrowser/AnchorBrowser-SDK-Python
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
anchorbrowser/__init__.py,sha256=Wl16NhVAsaRBCpDtHZjZXDY31QMKfCIRNjzJcfb8D9E,2728
|
|
2
|
-
anchorbrowser/_base_client.py,sha256=
|
|
2
|
+
anchorbrowser/_base_client.py,sha256=aBDVebaBXas9_pjEOBQfnYVkzfZLSqBHLQ0ojfOD3E0,73665
|
|
3
3
|
anchorbrowser/_client.py,sha256=C6r4pVrUxUcbEFB2KRKUkeuU6q7QTdlztbWZrjZp9jA,20246
|
|
4
|
-
anchorbrowser/_compat.py,sha256=
|
|
4
|
+
anchorbrowser/_compat.py,sha256=teO44AYozpv2wFRrUi7brcZfGPpFSERQZ4fcdX6zVvs,6627
|
|
5
5
|
anchorbrowser/_constants.py,sha256=5PS9gNlT7aVkf5APKjCI8lcWqII_saRiroEzDScVKEU,470
|
|
6
6
|
anchorbrowser/_exceptions.py,sha256=Qz7WOsYUFZ3bEoN28V-C9Wk-EvYerqP83-fMUINlZKQ,3234
|
|
7
7
|
anchorbrowser/_files.py,sha256=l2iwVskD9JQ4iZJU9ZcsucF4VBARg5nEFWpiFfPcT-M,3630
|
|
@@ -11,11 +11,12 @@ anchorbrowser/_resource.py,sha256=7lE1EgpVj5kwckk-27umtigTOf9nKTyRl97cgNwRbRQ,11
|
|
|
11
11
|
anchorbrowser/_response.py,sha256=xsiyWOC8LWW-NvbFtZ-MJD4f7eI9RnivKwtKImZ-8o4,28860
|
|
12
12
|
anchorbrowser/_streaming.py,sha256=ey2jst1hntYHV6HDiCFfHhWr_dUCSG4dG-VUqQkmCQ4,10249
|
|
13
13
|
anchorbrowser/_types.py,sha256=QvYWm0TMkfoauZj7cJwLtTrdnHfy0Wl7490nj7RFC9I,7601
|
|
14
|
-
anchorbrowser/_version.py,sha256=
|
|
14
|
+
anchorbrowser/_version.py,sha256=wwyJv_U8gogcvliHpqAu9VzR-xTXlX8XRQaDsX7IFIg,165
|
|
15
15
|
anchorbrowser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
anchorbrowser/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
17
17
|
anchorbrowser/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
18
18
|
anchorbrowser/_utils/_datetime_parse.py,sha256=bABTs0Bc6rabdFvnIwXjEhWL15TcRgWZ_6XGTqN8xUk,4204
|
|
19
|
+
anchorbrowser/_utils/_json.py,sha256=bl95uuIWwgSfXX-gP1trK_lDAPwJujYfJ05Cxo2SEC4,962
|
|
19
20
|
anchorbrowser/_utils/_logs.py,sha256=VECnOdIr_cYELMwV_E72FPDY8f1qoYxASex-FciwPxc,795
|
|
20
21
|
anchorbrowser/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
|
|
21
22
|
anchorbrowser/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
|
@@ -29,7 +30,7 @@ anchorbrowser/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
|
29
30
|
anchorbrowser/lib/agent.py,sha256=8Se6hKIbGQIbhON4BpDzA8HhFbubDgbry4MN-WeT8Xg,3711
|
|
30
31
|
anchorbrowser/lib/browser.py,sha256=Bq1HBeoxErULdMG8DajDglp3dUP68XMiW94C8YDCleE,6387
|
|
31
32
|
anchorbrowser/resources/__init__.py,sha256=9dv_oPSt9xCrVtlTsyPhFyfef2LreNaYgvmwCF8YvyE,3897
|
|
32
|
-
anchorbrowser/resources/agent.py,sha256=
|
|
33
|
+
anchorbrowser/resources/agent.py,sha256=ovQ81QySbTjHhjsveGkOQ6SSm_q2MIiB5XbUhznZ3Cs,20319
|
|
33
34
|
anchorbrowser/resources/browser.py,sha256=BB5hq_ayIDL_ziYHq13oj8US3XkHzkoXiGLBm7h9dH0,5548
|
|
34
35
|
anchorbrowser/resources/events.py,sha256=B6TwziBmOVMjWwoFO7OJR2X_Jt_3jtzNhQg4lgY-7SE,10780
|
|
35
36
|
anchorbrowser/resources/extensions.py,sha256=KPBQGvjXU-cThWcd9Gf7xBBhEKjxxtaJqZiPF-hA0Ho,5131
|
|
@@ -127,7 +128,7 @@ anchorbrowser/types/sessions/agent/file_upload_response.py,sha256=9DnqplfvEud89U
|
|
|
127
128
|
anchorbrowser/types/sessions/recordings/__init__.py,sha256=OKfJYcKb4NObdiRObqJV_dOyDQ8feXekDUge2o_4pXQ,122
|
|
128
129
|
anchorbrowser/types/shared/__init__.py,sha256=FQKjY3VDxI8T0feNRazdY5TOqb2KDeEwZaoJjsxuEl4,152
|
|
129
130
|
anchorbrowser/types/shared/success_response.py,sha256=l9OWrucXoSjBdsx5QKdvBPFtxv8d0YdpYY6iL5cWWuc,314
|
|
130
|
-
anchorbrowser-0.
|
|
131
|
-
anchorbrowser-0.
|
|
132
|
-
anchorbrowser-0.
|
|
133
|
-
anchorbrowser-0.
|
|
131
|
+
anchorbrowser-0.8.0.dist-info/METADATA,sha256=1jg50d6WZ9USXctNF2x-9KkRwonJqUKyxLd1Qci1md8,15407
|
|
132
|
+
anchorbrowser-0.8.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
133
|
+
anchorbrowser-0.8.0.dist-info/licenses/LICENSE,sha256=RDcfjK9SJCPlF8nKJnQ33ZQqG4pFl5sBT9AOoTQXK5Q,11343
|
|
134
|
+
anchorbrowser-0.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|