tinyfish 0.8.0__tar.gz → 0.8.1__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 (54) hide show
  1. {tinyfish-0.8.0 → tinyfish-0.8.1}/CHANGELOG.md +7 -0
  2. {tinyfish-0.8.0 → tinyfish-0.8.1}/PKG-INFO +1 -1
  3. {tinyfish-0.8.0 → tinyfish-0.8.1}/pyproject.toml +1 -1
  4. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/client/_base.py +13 -0
  5. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_client.py +13 -0
  6. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_vault.py +37 -0
  7. {tinyfish-0.8.0 → tinyfish-0.8.1}/.gitignore +0 -0
  8. {tinyfish-0.8.0 → tinyfish-0.8.1}/.pre-commit-config.yaml +0 -0
  9. {tinyfish-0.8.0 → tinyfish-0.8.1}/AGENTS.md +0 -0
  10. {tinyfish-0.8.0 → tinyfish-0.8.1}/CLAUDE.md +0 -0
  11. {tinyfish-0.8.0 → tinyfish-0.8.1}/README.md +0 -0
  12. {tinyfish-0.8.0 → tinyfish-0.8.1}/RELEASE.md +0 -0
  13. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/exceptions-and-errors-guide.md +0 -0
  14. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/internal/api-integration-header.md +0 -0
  15. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/internal/exceptions-and-errors-guide.md +0 -0
  16. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/internal/publishing-private-guide.md +0 -0
  17. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/pagination-guide.md +0 -0
  18. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/proxy-and-browser-profiles.md +0 -0
  19. {tinyfish-0.8.0 → tinyfish-0.8.1}/docs/streaming-guide.md +0 -0
  20. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/__init__.py +0 -0
  21. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/__init__.py +0 -0
  22. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/client/__init__.py +0 -0
  23. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/client/async_.py +0 -0
  24. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/client/sync.py +0 -0
  25. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/exceptions.py +0 -0
  26. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/resource.py +0 -0
  27. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/_utils/sse_parser.py +0 -0
  28. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/agent/__init__.py +0 -0
  29. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/agent/types.py +0 -0
  30. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/browser/__init__.py +0 -0
  31. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/browser/types.py +0 -0
  32. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/client.py +0 -0
  33. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/fetch/__init__.py +0 -0
  34. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/fetch/types.py +0 -0
  35. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/py.typed +0 -0
  36. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/runs/__init__.py +0 -0
  37. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/runs/types.py +0 -0
  38. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/search/__init__.py +0 -0
  39. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/search/types.py +0 -0
  40. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/vault/__init__.py +0 -0
  41. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/vault/types.py +0 -0
  42. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/wallet/__init__.py +0 -0
  43. {tinyfish-0.8.0 → tinyfish-0.8.1}/src/tinyfish/wallet/types.py +0 -0
  44. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/__init__.py +0 -0
  45. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/conftest.py +0 -0
  46. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_agent.py +0 -0
  47. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_browser.py +0 -0
  48. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_errors.py +0 -0
  49. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_fetch.py +0 -0
  50. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_runs.py +0 -0
  51. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_search.py +0 -0
  52. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/test_wallet.py +0 -0
  53. {tinyfish-0.8.0 → tinyfish-0.8.1}/tests/testing_guide.md +0 -0
  54. {tinyfish-0.8.0 → tinyfish-0.8.1}/uv.lock +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.1](https://github.com/tinyfish-io/ux-labs/compare/sdk-py/v0.8.0...sdk-py/v0.8.1) (2026-09-16)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **vault:** Make reconnection safe across dashboard and API clients ([#4971](https://github.com/tinyfish-io/ux-labs/issues/4971)) ([3fbd712](https://github.com/tinyfish-io/ux-labs/commit/3fbd712a31fd3c565919103b904f691e3b9a0cd0))
9
+
3
10
  ## [0.8.0](https://github.com/tinyfish-io/ux-labs/compare/sdk-py/v0.7.0...sdk-py/v0.8.0) (2026-09-02)
4
11
 
5
12
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tinyfish
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: Official Python SDK for the TinyFish API
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: httpx>=0.27.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tinyfish"
3
- version = "0.8.0"
3
+ version = "0.8.1"
4
4
  description = "Official Python SDK for the TinyFish API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import os
6
6
  from importlib.metadata import version as _pkg_version
7
7
  from typing import Any, Literal, TypeVar
8
+ from uuid import UUID
8
9
 
9
10
  import httpx
10
11
  from pydantic import BaseModel
@@ -37,6 +38,13 @@ def _sanitize_client_header(value: str) -> str:
37
38
  return "".join(ch for ch in value if 32 <= ord(ch) <= 126).strip()[:128]
38
39
 
39
40
 
41
+ def _connect_attempt_id(value: str) -> str:
42
+ try:
43
+ return str(UUID(value))
44
+ except ValueError:
45
+ return ""
46
+
47
+
40
48
  DEFAULT_BASE_URL = "https://agent.tinyfish.ai"
41
49
 
42
50
  # Search and Fetch have their own hostnames, which serve the API at the root path. They are
@@ -109,10 +117,15 @@ class _BaseClient:
109
117
  }
110
118
  client_name = _sanitize_client_header(os.environ.get("TF_CLIENT_NAME", ""))
111
119
  client_version = _sanitize_client_header(os.environ.get("TF_CLIENT_VERSION", ""))
120
+ connect_attempt_id = _connect_attempt_id(os.environ.get("TINYFISH_RUNTIME_ATTEMPT_ID", ""))
112
121
  if client_name:
113
122
  headers["X-TF-Client-Name"] = client_name
114
123
  if client_version:
115
124
  headers["X-TF-Client-Version"] = client_version
125
+ if connect_attempt_id:
126
+ headers["X-TF-Connect-Source"] = "setup_page"
127
+ headers["X-TF-Connect-Client"] = "python"
128
+ headers["X-TF-Connect-Attempt-Id"] = connect_attempt_id
116
129
  return headers
117
130
 
118
131
  @staticmethod
@@ -244,6 +244,19 @@ def test_client_headers_via_env(respx_mock: MockRouter):
244
244
  assert headers["x-tf-client-version"] == "1.2.3"
245
245
 
246
246
 
247
+ @pytest.mark.respx(base_url=BASE_URL)
248
+ def test_setup_page_connect_headers_via_env(respx_mock: MockRouter):
249
+ attempt_id = "11111111-1111-4111-8111-111111111111"
250
+ with mock.patch.dict(os.environ, {"TINYFISH_RUNTIME_ATTEMPT_ID": attempt_id}):
251
+ c = TinyFish(api_key=API_KEY, base_url=BASE_URL, max_retries=0)
252
+ route = respx_mock.post(_PATH).mock(return_value=httpx.Response(200, json=_RUN_OK))
253
+ c.agent.run(**_BODY)
254
+ headers = route.calls[0].request.headers
255
+ assert headers["x-tf-connect-source"] == "setup_page"
256
+ assert headers["x-tf-connect-client"] == "python"
257
+ assert headers["x-tf-connect-attempt-id"] == attempt_id
258
+
259
+
247
260
  # Without TF_CLIENT_NAME / TF_CLIENT_VERSION, client headers are absent
248
261
  @pytest.mark.respx(base_url=BASE_URL)
249
262
  def test_no_client_headers_by_default(respx_mock: MockRouter):
@@ -296,6 +296,24 @@ def test_sync_items_returns_response(client: TinyFish, respx_mock: MockRouter):
296
296
  assert result.sync_summary.removed == 0
297
297
 
298
298
 
299
+ @pytest.mark.respx(base_url=BASE_URL)
300
+ def test_sync_items_preserves_reconnect_required_code(client: TinyFish, respx_mock: MockRouter):
301
+ respx_mock.post(_SYNC_PATH).mock(
302
+ return_value=httpx.Response(
303
+ 401,
304
+ json={
305
+ "error": {
306
+ "code": "VAULT_RECONNECT_REQUIRED",
307
+ "message": "Vault connection expired. Please reconnect your vault.",
308
+ }
309
+ },
310
+ )
311
+ )
312
+ with pytest.raises(AuthenticationError) as exc:
313
+ client.vault.items.sync()
314
+ assert exc.value.code == "VAULT_RECONNECT_REQUIRED"
315
+
316
+
299
317
  # ═══════════════════════════════════════════════════════════════════════════════
300
318
  # vault.connections.connect_1password — async
301
319
  # ═══════════════════════════════════════════════════════════════════════════════
@@ -415,6 +433,25 @@ async def test_async_sync_items_returns_response(async_client: AsyncTinyFish, re
415
433
  assert len(result.items) == 1
416
434
 
417
435
 
436
+ @pytest.mark.respx(base_url=BASE_URL)
437
+ async def test_async_sync_items_preserves_reconnect_required_code(async_client: AsyncTinyFish, respx_mock: MockRouter):
438
+ respx_mock.post(_SYNC_PATH).mock(
439
+ return_value=httpx.Response(
440
+ 401,
441
+ json={
442
+ "error": {
443
+ "code": "VAULT_RECONNECT_REQUIRED",
444
+ "message": "Vault connection expired. Please reconnect your vault.",
445
+ }
446
+ },
447
+ )
448
+ )
449
+ async with async_client as c:
450
+ with pytest.raises(AuthenticationError) as exc:
451
+ await c.vault.items.sync()
452
+ assert exc.value.code == "VAULT_RECONNECT_REQUIRED"
453
+
454
+
418
455
  # ═══════════════════════════════════════════════════════════════════════════════
419
456
  # vault — error handling (async)
420
457
  # ═══════════════════════════════════════════════════════════════════════════════
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes