tvkit 0.18.1__tar.gz → 0.18.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.
Files changed (120) hide show
  1. {tvkit-0.18.1/tvkit.egg-info → tvkit-0.18.2}/PKG-INFO +6 -4
  2. {tvkit-0.18.1 → tvkit-0.18.2}/pyproject.toml +14 -5
  3. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_authentication.py +33 -0
  4. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_dependency_declarations.py +17 -0
  5. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/__init__.py +1 -1
  6. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/utils/symbol_validator.py +2 -2
  7. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/auth_manager.py +7 -4
  8. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/probe_cache.py +8 -1
  9. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/profile_parser.py +6 -2
  10. {tvkit-0.18.1 → tvkit-0.18.2/tvkit.egg-info}/PKG-INFO +6 -4
  11. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit.egg-info/requires.txt +3 -3
  12. {tvkit-0.18.1 → tvkit-0.18.2}/LICENSE +0 -0
  13. {tvkit-0.18.1 → tvkit-0.18.2}/README.md +0 -0
  14. {tvkit-0.18.1 → tvkit-0.18.2}/setup.cfg +0 -0
  15. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_adjustment_enum.py +0 -0
  16. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_batch_downloader.py +0 -0
  17. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_connection_retry.py +0 -0
  18. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_connection_service.py +0 -0
  19. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_credential_safety.py +0 -0
  20. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_docs_markdown.py +0 -0
  21. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_export_module.py +0 -0
  22. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_export_timestamp_format.py +0 -0
  23. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_export_validation.py +0 -0
  24. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_fundamentals_catalog.py +0 -0
  25. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_fundamentals_client.py +0 -0
  26. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_fundamentals_export.py +0 -0
  27. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_fundamentals_models.py +0 -0
  28. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_fundamentals_transport.py +0 -0
  29. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_futures_range_degradation.py +0 -0
  30. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_historical_ohlcv.py +0 -0
  31. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_indicator_service.py +0 -0
  32. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_interval_validation.py +0 -0
  33. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_ohlcv_models.py +0 -0
  34. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_ohlcv_range_filter.py +0 -0
  35. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_ohlcv_reconnect.py +0 -0
  36. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_ohlcv_symbol_integration.py +0 -0
  37. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_range_end_bounds.py +0 -0
  38. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_range_segmentation.py +0 -0
  39. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_realtime_models.py +0 -0
  40. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_retry_backoff.py +0 -0
  41. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_scanner_models.py +0 -0
  42. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_scanner_row_drop.py +0 -0
  43. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_segmented_fetch.py +0 -0
  44. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_series_errors.py +0 -0
  45. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_symbols_config.py +0 -0
  46. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_symbols_normalizer.py +0 -0
  47. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_timezone_utils.py +0 -0
  48. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_utils.py +0 -0
  49. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_validation_checks.py +0 -0
  50. {tvkit-0.18.1 → tvkit-0.18.2}/tests/test_validation_composite.py +0 -0
  51. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/__main__.py +0 -0
  52. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/__init__.py +0 -0
  53. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/__init__.py +0 -0
  54. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/exceptions.py +0 -0
  55. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/models/__init__.py +0 -0
  56. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/models/adjustment.py +0 -0
  57. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/models/ohlcv.py +0 -0
  58. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/models/realtime.py +0 -0
  59. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/models/stream_models.py +0 -0
  60. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/ohlcv.py +0 -0
  61. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/services/__init__.py +0 -0
  62. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/services/connection_service.py +0 -0
  63. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/services/message_service.py +0 -0
  64. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/services/segmented_fetch_service.py +0 -0
  65. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/chart/utils.py +0 -0
  66. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/fundamentals/__init__.py +0 -0
  67. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/fundamentals/catalog.py +0 -0
  68. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/fundamentals/client.py +0 -0
  69. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/fundamentals/exceptions.py +0 -0
  70. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/fundamentals/models.py +0 -0
  71. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/fundamentals/transport.py +0 -0
  72. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/scanner/__init__.py +0 -0
  73. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/scanner/markets.py +0 -0
  74. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/scanner/models/__init__.py +0 -0
  75. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/scanner/models/scanner.py +0 -0
  76. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/scanner/services/__init__.py +0 -0
  77. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/scanner/services/scanner_service.py +0 -0
  78. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/utils/__init__.py +0 -0
  79. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/utils/indicator_service.py +0 -0
  80. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/utils/models.py +0 -0
  81. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/utils/retry.py +0 -0
  82. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/api/utils/timestamp.py +0 -0
  83. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/__init__.py +0 -0
  84. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/capability_detector.py +0 -0
  85. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/cookie_provider.py +0 -0
  86. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/credentials.py +0 -0
  87. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/exceptions.py +0 -0
  88. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/models.py +0 -0
  89. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/auth/token_provider.py +0 -0
  90. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/batch/__init__.py +0 -0
  91. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/batch/downloader.py +0 -0
  92. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/batch/exceptions.py +0 -0
  93. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/batch/models.py +0 -0
  94. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/cli.py +0 -0
  95. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/__init__.py +0 -0
  96. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/data_exporter.py +0 -0
  97. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/formatters/__init__.py +0 -0
  98. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/formatters/base_formatter.py +0 -0
  99. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/formatters/csv_formatter.py +0 -0
  100. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/formatters/json_formatter.py +0 -0
  101. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/formatters/polars_formatter.py +0 -0
  102. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/export/models.py +0 -0
  103. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/helpers.py +0 -0
  104. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/py.typed +0 -0
  105. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/quickstart.py +0 -0
  106. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/symbols/__init__.py +0 -0
  107. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/symbols/exceptions.py +0 -0
  108. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/symbols/models.py +0 -0
  109. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/symbols/normalizer.py +0 -0
  110. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/time/__init__.py +0 -0
  111. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/time/conversion.py +0 -0
  112. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/time/exchange.py +0 -0
  113. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/validation/__init__.py +0 -0
  114. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/validation/checks.py +0 -0
  115. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/validation/exceptions.py +0 -0
  116. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/validation/models.py +0 -0
  117. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit/validation/validator.py +0 -0
  118. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit.egg-info/SOURCES.txt +0 -0
  119. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit.egg-info/dependency_links.txt +0 -0
  120. {tvkit-0.18.1 → tvkit-0.18.2}/tvkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tvkit
3
- Version: 0.18.1
3
+ Version: 0.18.2
4
4
  Summary: tvkit is a Python library that fetches real-time stock data from TradingView, including price, market cap, P/E ratio, ROE, and more for stocks from multiple countries. Easily access and analyze financial metrics for global markets.
5
5
  Author-email: lumduan <b@candythink.com>
6
6
  License-Expression: MIT
@@ -15,6 +15,8 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
18
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
21
  Classifier: Topic :: Office/Business :: Financial
20
22
  Requires-Python: >=3.11
@@ -24,14 +26,14 @@ Requires-Dist: pydantic>=2.0.0
24
26
  Requires-Dist: pydantic-settings>=2.15.0
25
27
  Requires-Dist: websockets>=17.0.1
26
28
  Requires-Dist: httpx>=0.24.0
27
- Requires-Dist: polars>=1.44.0
28
- Requires-Dist: browser-cookie3>=0.20.1
29
+ Requires-Dist: polars>=1.44.1
30
+ Requires-Dist: browser-cookie3==0.20.1
29
31
  Requires-Dist: pyyaml>=6.0.3
30
32
  Provides-Extra: pandas
31
33
  Requires-Dist: pandas>=3.0.5; extra == "pandas"
32
34
  Requires-Dist: pyarrow>=25.0.1; extra == "pandas"
33
35
  Provides-Extra: dev
34
- Requires-Dist: ruff==0.16.4; extra == "dev"
36
+ Requires-Dist: ruff==0.17.6; extra == "dev"
35
37
  Requires-Dist: pytest>=9.1.1; extra == "dev"
36
38
  Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
37
39
  Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tvkit"
3
- version = "0.18.1"
3
+ version = "0.18.2"
4
4
  description = "tvkit is a Python library that fetches real-time stock data from TradingView, including price, market cap, P/E ratio, ROE, and more for stocks from multiple countries. Easily access and analyze financial metrics for global markets."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -15,6 +15,8 @@ classifiers = [
15
15
  "Programming Language :: Python :: 3.11",
16
16
  "Programming Language :: Python :: 3.12",
17
17
  "Programming Language :: Python :: 3.13",
18
+ "Programming Language :: Python :: 3.14",
19
+ "Programming Language :: Python :: 3.15",
18
20
  "Topic :: Software Development :: Libraries :: Python Modules",
19
21
  "Topic :: Office/Business :: Financial",
20
22
  ]
@@ -23,8 +25,12 @@ dependencies = [
23
25
  "pydantic-settings>=2.15.0",
24
26
  "websockets>=17.0.1",
25
27
  "httpx>=0.24.0",
26
- "polars>=1.44.0",
27
- "browser-cookie3>=0.20.1",
28
+ "polars>=1.44.1",
29
+ # Exact pin, on purpose. browser-cookie3 reads and decrypts the user's browser cookie
30
+ # stores, and upstream has been dormant since 2024-12 (last release 0.20.1, 2025-01-04).
31
+ # Without a pin, a new release (say after a takeover of the PyPI name) would install
32
+ # automatically. A bump is a reviewed decision; see SECURITY.md.
33
+ "browser-cookie3==0.20.1",
28
34
  "pyyaml>=6.0.3",
29
35
  ]
30
36
 
@@ -36,7 +42,7 @@ pandas = [
36
42
  "pyarrow>=25.0.1",
37
43
  ]
38
44
  dev = [
39
- "ruff==0.16.4",
45
+ "ruff==0.17.6",
40
46
  "pytest>=9.1.1",
41
47
  "pytest-asyncio>=0.23.0",
42
48
  "pytest-cov>=5.0.0",
@@ -106,6 +112,9 @@ indent-style = "space"
106
112
  [tool.pytest.ini_options]
107
113
  testpaths = ["tests"]
108
114
  asyncio_mode = "strict"
115
+ # Explicit, to silence pytest-asyncio's "unset" deprecation. tvkit has no async fixtures, so
116
+ # this changes no behaviour; "function" is also pytest-asyncio's announced future default.
117
+ asyncio_default_fixture_loop_scope = "function"
109
118
 
110
119
  [dependency-groups]
111
120
  dev = [
@@ -116,6 +125,6 @@ dev = [
116
125
  "pytest-asyncio>=1.1.0",
117
126
  "pytest-cov>=7.0.0",
118
127
  "rich>=15.0.0",
119
- "ruff>=0.16.4",
128
+ "ruff>=0.17.6",
120
129
  "twine>=7.0.0",
121
130
  ]
@@ -230,6 +230,19 @@ class TestProfileParser:
230
230
  profile = ProfileParser.parse(html)
231
231
  assert profile["id"] == 3
232
232
 
233
+ def test_script_end_tag_variants_are_recognised(self) -> None:
234
+ """`</script >` and `</SCRIPT\n>` close a script block too (CodeQL py/bad-tag-filter)."""
235
+ html = (
236
+ "<html><script>var a=1;</script >"
237
+ '<SCRIPT type="text/javascript">var b=2;</SCRIPT\n>'
238
+ "<script>var c=3;</scripts>still c</script></html>"
239
+ )
240
+ assert ProfileParser._extract_script_blocks(html) == [
241
+ "var a=1;",
242
+ "var b=2;",
243
+ "var c=3;</scripts>still c",
244
+ ]
245
+
233
246
  def test_balanced_brace_extract_basic(self) -> None:
234
247
  text = 'start {"key": "value", "nested": {"a": 1}} end'
235
248
  result = ProfileParser._balanced_brace_extract(text, 6)
@@ -1642,3 +1655,23 @@ class TestRealBrowserAuth:
1642
1655
  async with AuthManager() as auth:
1643
1656
  assert auth.auth_token == "unauthorized_user_token"
1644
1657
  assert auth.account is None
1658
+
1659
+
1660
+ def test_auth_token_guard_survives_python_O() -> None:
1661
+ """The guard raises under `python -O` too: it must not be an `assert` statement."""
1662
+ import subprocess
1663
+ import sys
1664
+
1665
+ code = (
1666
+ "from tvkit.auth import AuthManager, TradingViewCredentials\n"
1667
+ "try:\n"
1668
+ " AuthManager(TradingViewCredentials()).auth_token\n"
1669
+ "except AssertionError:\n"
1670
+ " print('raised')\n"
1671
+ "else:\n"
1672
+ " print('returned')\n"
1673
+ )
1674
+ out = subprocess.run(
1675
+ [sys.executable, "-O", "-c", code], capture_output=True, text=True, check=True
1676
+ ).stdout.strip()
1677
+ assert out == "raised"
@@ -224,3 +224,20 @@ def test_lazy_and_type_checking_imports_are_scanned() -> None:
224
224
  # lazy, inside _get_browser_cookie3()
225
225
  assert "browser_cookie3" in modules
226
226
  assert any("tvkit/auth/cookie_provider.py" in site for site in modules["browser_cookie3"])
227
+
228
+
229
+ def test_browser_cookie3_is_pinned_exactly() -> None:
230
+ """browser-cookie3 stays on an exact pin: a supply-chain hold, not an oversight.
231
+
232
+ It reads and decrypts the user's browser cookie stores, and upstream has been dormant
233
+ since 2024-12. With an open range, a new release (for example after a takeover of the
234
+ PyPI name) would install automatically for every user. Bumping the pin is a reviewed
235
+ decision (SECURITY.md). This test makes sure it is never silently loosened back to ``>=``.
236
+ """
237
+ pyproject = tomllib.loads(PYPROJECT.read_text(encoding="utf-8"))
238
+ specs = [
239
+ r
240
+ for r in pyproject["project"]["dependencies"]
241
+ if _normalize(re.split(r"[<>=!~;\[ ]", r)[0]) == "browser-cookie3"
242
+ ]
243
+ assert specs == ["browser-cookie3==0.20.1"], specs
@@ -16,7 +16,7 @@ Quick Start:
16
16
  >>> data = asyncio.run(get_apple_data())
17
17
  """
18
18
 
19
- __version__ = "0.18.1"
19
+ __version__ = "0.18.2"
20
20
  __author__ = "lumduan"
21
21
  __license__ = "MIT"
22
22
 
@@ -103,7 +103,7 @@ async def validate_symbols(exchange_symbol: str | list[str]) -> bool:
103
103
  if exc.response.status_code == 404:
104
104
  raise ValueError(f"Invalid exchange or symbol or index '{item}'") from exc
105
105
 
106
- logging.warning(
106
+ logger.warning(
107
107
  "Attempt %d failed to validate symbol '%s': %s",
108
108
  attempt + 1,
109
109
  item,
@@ -117,7 +117,7 @@ async def validate_symbols(exchange_symbol: str | list[str]) -> bool:
117
117
  f"Invalid symbol '{item}' after {retries} attempts"
118
118
  ) from exc
119
119
  except httpx.RequestError as exc:
120
- logging.warning(
120
+ logger.warning(
121
121
  "Attempt %d failed to validate symbol '%s': %s",
122
122
  attempt + 1,
123
123
  item,
@@ -244,10 +244,13 @@ class AuthManager:
244
244
  Raises:
245
245
  AssertionError: If accessed before entering the async context manager.
246
246
  """
247
- assert self._auth_token is not None, (
248
- "auth_token is not set — use 'async with AuthManager(...) as auth' "
249
- "before accessing auth.auth_token"
250
- )
247
+ if self._auth_token is None:
248
+ # An explicit raise, not `assert`: `python -O` strips asserts, which would turn
249
+ # this guard into a silent `None` instead of the documented AssertionError.
250
+ raise AssertionError(
251
+ "auth_token is not set — use 'async with AuthManager(...) as auth' "
252
+ "before accessing auth.auth_token"
253
+ )
251
254
  return self._auth_token
252
255
 
253
256
  @property
@@ -1,4 +1,11 @@
1
- """Optional disk cache for background capability probe results."""
1
+ """Optional disk cache for background capability probe results.
2
+
3
+ Intentionally not wired in (decided 2026-11-30, recorded so nobody mistakes it for a bug):
4
+ ``AuthManager`` does not use this cache; it runs its capability probe on every session. The
5
+ class is kept as a public, hardened utility for callers who want to cache probe results
6
+ themselves. Wiring it into ``AuthManager`` would change behaviour (files under
7
+ ``~/.cache/tvkit``) and needs its own decision.
8
+ """
2
9
 
3
10
  import json
4
11
  import logging
@@ -21,9 +21,13 @@ BOOTSTRAP_CONTAINERS: list[str] = [
21
21
  ]
22
22
 
23
23
  # Compiled patterns for HTML script block extraction.
24
- _SCRIPT_RE: re.Pattern[str] = re.compile(r"<script[^>]*>(.*?)</script>", re.DOTALL | re.IGNORECASE)
24
+ # End tags may carry whitespace or junk before ">" (`</script >`, `</SCRIPT\n>`), which HTML
25
+ # parsers accept. Matching only a literal `</script>` missed those (CodeQL py/bad-tag-filter).
26
+ _SCRIPT_RE: re.Pattern[str] = re.compile(
27
+ r"<script\b[^>]*>(.*?)</script\b[^>]*>", re.DOTALL | re.IGNORECASE
28
+ )
25
29
  _JSON_SCRIPT_RE: re.Pattern[str] = re.compile(
26
- r'<script[^>]*type=["\']application/json["\'][^>]*>(.*?)</script>',
30
+ r'<script\b[^>]*type=["\']application/json["\'][^>]*>(.*?)</script\b[^>]*>',
27
31
  re.DOTALL | re.IGNORECASE,
28
32
  )
29
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tvkit
3
- Version: 0.18.1
3
+ Version: 0.18.2
4
4
  Summary: tvkit is a Python library that fetches real-time stock data from TradingView, including price, market cap, P/E ratio, ROE, and more for stocks from multiple countries. Easily access and analyze financial metrics for global markets.
5
5
  Author-email: lumduan <b@candythink.com>
6
6
  License-Expression: MIT
@@ -15,6 +15,8 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
18
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
21
  Classifier: Topic :: Office/Business :: Financial
20
22
  Requires-Python: >=3.11
@@ -24,14 +26,14 @@ Requires-Dist: pydantic>=2.0.0
24
26
  Requires-Dist: pydantic-settings>=2.15.0
25
27
  Requires-Dist: websockets>=17.0.1
26
28
  Requires-Dist: httpx>=0.24.0
27
- Requires-Dist: polars>=1.44.0
28
- Requires-Dist: browser-cookie3>=0.20.1
29
+ Requires-Dist: polars>=1.44.1
30
+ Requires-Dist: browser-cookie3==0.20.1
29
31
  Requires-Dist: pyyaml>=6.0.3
30
32
  Provides-Extra: pandas
31
33
  Requires-Dist: pandas>=3.0.5; extra == "pandas"
32
34
  Requires-Dist: pyarrow>=25.0.1; extra == "pandas"
33
35
  Provides-Extra: dev
34
- Requires-Dist: ruff==0.16.4; extra == "dev"
36
+ Requires-Dist: ruff==0.17.6; extra == "dev"
35
37
  Requires-Dist: pytest>=9.1.1; extra == "dev"
36
38
  Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
37
39
  Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
@@ -2,12 +2,12 @@ pydantic>=2.0.0
2
2
  pydantic-settings>=2.15.0
3
3
  websockets>=17.0.1
4
4
  httpx>=0.24.0
5
- polars>=1.44.0
6
- browser-cookie3>=0.20.1
5
+ polars>=1.44.1
6
+ browser-cookie3==0.20.1
7
7
  pyyaml>=6.0.3
8
8
 
9
9
  [dev]
10
- ruff==0.16.4
10
+ ruff==0.17.6
11
11
  pytest>=9.1.1
12
12
  pytest-asyncio>=0.23.0
13
13
  pytest-cov>=5.0.0
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
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