anchorbrowser 0.3.10__py3-none-any.whl → 0.3.12__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.
@@ -54,11 +54,12 @@ class Stream(Generic[_T]):
54
54
  process_data = self._client._process_response_data
55
55
  iterator = self._iter_events()
56
56
 
57
- for sse in iterator:
58
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
59
-
60
- # As we might not fully consume the response stream, we need to close it explicitly
61
- response.close()
57
+ try:
58
+ for sse in iterator:
59
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
60
+ finally:
61
+ # Ensure the response is closed even if the consumer doesn't read all data
62
+ response.close()
62
63
 
63
64
  def __enter__(self) -> Self:
64
65
  return self
@@ -117,11 +118,12 @@ class AsyncStream(Generic[_T]):
117
118
  process_data = self._client._process_response_data
118
119
  iterator = self._iter_events()
119
120
 
120
- async for sse in iterator:
121
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
122
-
123
- # As we might not fully consume the response stream, we need to close it explicitly
124
- await response.aclose()
121
+ try:
122
+ async for sse in iterator:
123
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
124
+ finally:
125
+ # Ensure the response is closed even if the consumer doesn't read all data
126
+ await response.aclose()
125
127
 
126
128
  async def __aenter__(self) -> Self:
127
129
  return self
anchorbrowser/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "anchorbrowser"
4
- __version__ = "0.3.10" # x-release-please-version
4
+ __version__ = "0.3.12" # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: anchorbrowser
3
- Version: 0.3.10
3
+ Version: 0.3.12
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
@@ -120,6 +120,7 @@ pip install anchorbrowser[aiohttp]
120
120
  Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
121
121
 
122
122
  ```python
123
+ import os
123
124
  import asyncio
124
125
  from anchorbrowser import DefaultAioHttpClient
125
126
  from anchorbrowser import AsyncAnchorbrowser
@@ -127,7 +128,7 @@ from anchorbrowser import AsyncAnchorbrowser
127
128
 
128
129
  async def main() -> None:
129
130
  async with AsyncAnchorbrowser(
130
- api_key="Your API Key",
131
+ api_key=os.environ.get("ANCHORBROWSER_API_KEY"), # This is the default and can be omitted
131
132
  http_client=DefaultAioHttpClient(),
132
133
  ) as client:
133
134
  session = await client.sessions.create(
@@ -9,9 +9,9 @@ anchorbrowser/_models.py,sha256=_qXPD2dQpvS5hqULjyh4V6J6ejhmMMnSkgCZx5BWZYc,3183
9
9
  anchorbrowser/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
10
10
  anchorbrowser/_resource.py,sha256=7lE1EgpVj5kwckk-27umtigTOf9nKTyRl97cgNwRbRQ,1142
11
11
  anchorbrowser/_response.py,sha256=xsiyWOC8LWW-NvbFtZ-MJD4f7eI9RnivKwtKImZ-8o4,28860
12
- anchorbrowser/_streaming.py,sha256=ageQnvSloL91I4OxR1GL6-V5sDa4A_99PX1Sgi-U7zY,10177
12
+ anchorbrowser/_streaming.py,sha256=ey2jst1hntYHV6HDiCFfHhWr_dUCSG4dG-VUqQkmCQ4,10249
13
13
  anchorbrowser/_types.py,sha256=hYSr4gk9908ZiGTqMX3pHhdzfzUUaHVelFS_I6p2Uj0,7243
14
- anchorbrowser/_version.py,sha256=AtdYmZoJvz0jZk_lruGk8rCsSdBl0a8RF4uZGy4TebU,166
14
+ anchorbrowser/_version.py,sha256=VdYvQVSKclqAmxjr2ICmV3HaQj06Qtn83DQsVnGI2b8,166
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
@@ -118,7 +118,7 @@ anchorbrowser/types/sessions/agent/file_upload_response.py,sha256=9DnqplfvEud89U
118
118
  anchorbrowser/types/sessions/recordings/__init__.py,sha256=OKfJYcKb4NObdiRObqJV_dOyDQ8feXekDUge2o_4pXQ,122
119
119
  anchorbrowser/types/shared/__init__.py,sha256=FQKjY3VDxI8T0feNRazdY5TOqb2KDeEwZaoJjsxuEl4,152
120
120
  anchorbrowser/types/shared/success_response.py,sha256=l9OWrucXoSjBdsx5QKdvBPFtxv8d0YdpYY6iL5cWWuc,314
121
- anchorbrowser-0.3.10.dist-info/METADATA,sha256=orjZa2rU8-EsEdxVFs-tgMHmHLc0p7hWG_fiXK-apc0,15331
122
- anchorbrowser-0.3.10.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
123
- anchorbrowser-0.3.10.dist-info/licenses/LICENSE,sha256=QYTH6OztHxnELDn890vME8F7-euzmsHhWI4XOSYxwOg,11343
124
- anchorbrowser-0.3.10.dist-info/RECORD,,
121
+ anchorbrowser-0.3.12.dist-info/METADATA,sha256=XVdJ6SOP_LHwyjuPMn49FA-BS3XzP7HQGDLrEPyDTvA,15408
122
+ anchorbrowser-0.3.12.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
123
+ anchorbrowser-0.3.12.dist-info/licenses/LICENSE,sha256=QYTH6OztHxnELDn890vME8F7-euzmsHhWI4XOSYxwOg,11343
124
+ anchorbrowser-0.3.12.dist-info/RECORD,,