settfex 0.26.1__tar.gz → 0.26.3__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 (343) hide show
  1. {settfex-0.26.1 → settfex-0.26.3}/.github/workflows/security.yml +6 -1
  2. {settfex-0.26.1 → settfex-0.26.3}/CHANGELOG.md +63 -0
  3. {settfex-0.26.1 → settfex-0.26.3}/CLAUDE.md +1 -0
  4. {settfex-0.26.1 → settfex-0.26.3}/PKG-INFO +1 -1
  5. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/utils/session_caching.md +20 -7
  6. {settfex-0.26.1 → settfex-0.26.3}/pyproject.toml +1 -1
  7. {settfex-0.26.1 → settfex-0.26.3}/settfex/__init__.py +1 -1
  8. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/data_fetcher.py +5 -1
  9. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/logging.py +7 -2
  10. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/session_manager.py +109 -13
  11. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_data_fetcher.py +33 -0
  12. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_logging_neighbourliness.py +43 -0
  13. settfex-0.26.3/tests/utils/test_session_manager.py +369 -0
  14. {settfex-0.26.1 → settfex-0.26.3}/uv.lock +219 -169
  15. settfex-0.26.1/tests/utils/test_session_manager.py +0 -157
  16. {settfex-0.26.1 → settfex-0.26.3}/.editorconfig +0 -0
  17. {settfex-0.26.1 → settfex-0.26.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  18. {settfex-0.26.1 → settfex-0.26.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  19. {settfex-0.26.1 → settfex-0.26.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  20. {settfex-0.26.1 → settfex-0.26.3}/.github/dependabot.yml +0 -0
  21. {settfex-0.26.1 → settfex-0.26.3}/.github/instructions/core-architectrual-principles.instructions.md +0 -0
  22. {settfex-0.26.1 → settfex-0.26.3}/.github/instructions/documentation-standards.instructions.md +0 -0
  23. {settfex-0.26.1 → settfex-0.26.3}/.github/instructions/file-organization.instructions.md +0 -0
  24. {settfex-0.26.1 → settfex-0.26.3}/.github/instructions/git-commit.instructions.md +0 -0
  25. {settfex-0.26.1 → settfex-0.26.3}/.github/instructions/python-dependency-management.instructions.md +0 -0
  26. {settfex-0.26.1 → settfex-0.26.3}/.github/prompts/Coding.prompt.md +0 -0
  27. {settfex-0.26.1 → settfex-0.26.3}/.github/prompts/Git-Commit-Reviewer.prompt.md +0 -0
  28. {settfex-0.26.1 → settfex-0.26.3}/.github/prompts/Prompt-Engineer.prompt.md +0 -0
  29. {settfex-0.26.1 → settfex-0.26.3}/.github/prompts/Python-Architect.prompt.md +0 -0
  30. {settfex-0.26.1 → settfex-0.26.3}/.github/workflows/ci.yml +0 -0
  31. {settfex-0.26.1 → settfex-0.26.3}/.github/workflows/dependency-drift.yml +0 -0
  32. {settfex-0.26.1 → settfex-0.26.3}/.github/workflows/live-smoke.yml +0 -0
  33. {settfex-0.26.1 → settfex-0.26.3}/.github/workflows/pre-commit.yml +0 -0
  34. {settfex-0.26.1 → settfex-0.26.3}/.github/workflows/release.yml +0 -0
  35. {settfex-0.26.1 → settfex-0.26.3}/.gitignore +0 -0
  36. {settfex-0.26.1 → settfex-0.26.3}/.pre-commit-config.yaml +0 -0
  37. {settfex-0.26.1 → settfex-0.26.3}/.python-version +0 -0
  38. {settfex-0.26.1 → settfex-0.26.3}/AGENTS.md +0 -0
  39. {settfex-0.26.1 → settfex-0.26.3}/CODE_OF_CONDUCT.md +0 -0
  40. {settfex-0.26.1 → settfex-0.26.3}/COMPREHENSIVE_AUDIT.md +0 -0
  41. {settfex-0.26.1 → settfex-0.26.3}/CONTRIBUTING.md +0 -0
  42. {settfex-0.26.1 → settfex-0.26.3}/LICENSE +0 -0
  43. {settfex-0.26.1 → settfex-0.26.3}/README.md +0 -0
  44. {settfex-0.26.1 → settfex-0.26.3}/RELEASING.md +0 -0
  45. {settfex-0.26.1 → settfex-0.26.3}/SECURITY.md +0 -0
  46. {settfex-0.26.1 → settfex-0.26.3}/docs/guide/PYTHON_LIBRARY_BEST_PRACTICES.md +0 -0
  47. {settfex-0.26.1 → settfex-0.26.3}/docs/index.md +0 -0
  48. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/sec/executive_trades.md +0 -0
  49. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/sec/financial_report.md +0 -0
  50. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/API_PROTECTION_NOTE.md +0 -0
  51. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/analyst_consensus.md +0 -0
  52. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/board_of_director.md +0 -0
  53. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/chart_quotation.md +0 -0
  54. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/corporate_action.md +0 -0
  55. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/dr_indicative_price.md +0 -0
  56. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/earnings_call.md +0 -0
  57. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/financial.md +0 -0
  58. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/highlight_data.md +0 -0
  59. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/holiday.md +0 -0
  60. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/index.md +0 -0
  61. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/info.md +0 -0
  62. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/latest_historical_trading.md +0 -0
  63. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/list.md +0 -0
  64. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/news.md +0 -0
  65. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/nvdr_holder.md +0 -0
  66. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/price_performance.md +0 -0
  67. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/profile_company.md +0 -0
  68. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/profile_dr.md +0 -0
  69. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/profile_stock.md +0 -0
  70. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/shareholder.md +0 -0
  71. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/set/trading_stat.md +0 -0
  72. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/tfex/list.md +0 -0
  73. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/tfex/trading_statistics.md +0 -0
  74. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/services/thaibma/yield_curve.md +0 -0
  75. {settfex-0.26.1 → settfex-0.26.3}/docs/settfex/utils/data_fetcher.md +0 -0
  76. {settfex-0.26.1 → settfex-0.26.3}/docs/solution/FINDINGS.md +0 -0
  77. {settfex-0.26.1 → settfex-0.26.3}/docs/solution/Performance Boost Session Caching Implementation.md +0 -0
  78. {settfex-0.26.1 → settfex-0.26.3}/docs/solution/SESSION_CACHE_SUMMARY.md +0 -0
  79. {settfex-0.26.1 → settfex-0.26.3}/docs/solution/SOLUTION_100_PERCENT.md +0 -0
  80. {settfex-0.26.1 → settfex-0.26.3}/examples/README.md +0 -0
  81. {settfex-0.26.1 → settfex-0.26.3}/examples/sec/01_financial_report.ipynb +0 -0
  82. {settfex-0.26.1 → settfex-0.26.3}/examples/sec/02_executive_trades.ipynb +0 -0
  83. {settfex-0.26.1 → settfex-0.26.3}/examples/set/01_stock_list.ipynb +0 -0
  84. {settfex-0.26.1 → settfex-0.26.3}/examples/set/02_highlight_data.ipynb +0 -0
  85. {settfex-0.26.1 → settfex-0.26.3}/examples/set/03_stock_profile.ipynb +0 -0
  86. {settfex-0.26.1 → settfex-0.26.3}/examples/set/04_company_profile.ipynb +0 -0
  87. {settfex-0.26.1 → settfex-0.26.3}/examples/set/05_corporate_action.ipynb +0 -0
  88. {settfex-0.26.1 → settfex-0.26.3}/examples/set/06_shareholder.ipynb +0 -0
  89. {settfex-0.26.1 → settfex-0.26.3}/examples/set/07_nvdr_holder.ipynb +0 -0
  90. {settfex-0.26.1 → settfex-0.26.3}/examples/set/08_board_of_director.ipynb +0 -0
  91. {settfex-0.26.1 → settfex-0.26.3}/examples/set/09_trading_statistics.ipynb +0 -0
  92. {settfex-0.26.1 → settfex-0.26.3}/examples/set/10_price_performance.ipynb +0 -0
  93. {settfex-0.26.1 → settfex-0.26.3}/examples/set/11_financial.ipynb +0 -0
  94. {settfex-0.26.1 → settfex-0.26.3}/examples/set/12_earnings_call.ipynb +0 -0
  95. {settfex-0.26.1 → settfex-0.26.3}/examples/set/13_chart_quotation.ipynb +0 -0
  96. {settfex-0.26.1 → settfex-0.26.3}/examples/set/14_latest_historical_trading.ipynb +0 -0
  97. {settfex-0.26.1 → settfex-0.26.3}/examples/set/15_market_index.ipynb +0 -0
  98. {settfex-0.26.1 → settfex-0.26.3}/examples/set/16_news.ipynb +0 -0
  99. {settfex-0.26.1 → settfex-0.26.3}/examples/set/17_holiday.ipynb +0 -0
  100. {settfex-0.26.1 → settfex-0.26.3}/examples/set/18_dr_and_asset_type.ipynb +0 -0
  101. {settfex-0.26.1 → settfex-0.26.3}/examples/set/19_analyst_consensus.ipynb +0 -0
  102. {settfex-0.26.1 → settfex-0.26.3}/examples/set/20_stock_info.ipynb +0 -0
  103. {settfex-0.26.1 → settfex-0.26.3}/examples/set/README.md +0 -0
  104. {settfex-0.26.1 → settfex-0.26.3}/examples/set/cpall_balance_sheet.csv +0 -0
  105. {settfex-0.26.1 → settfex-0.26.3}/examples/set/market_dashboard_20251005_173221.csv +0 -0
  106. {settfex-0.26.1 → settfex-0.26.3}/examples/set/market_dashboard_20251005_210737.csv +0 -0
  107. {settfex-0.26.1 → settfex-0.26.3}/examples/set/market_dashboard_20251006_091440.csv +0 -0
  108. {settfex-0.26.1 → settfex-0.26.3}/examples/set/thailand_banking_stocks.csv +0 -0
  109. {settfex-0.26.1 → settfex-0.26.3}/examples/set/thailand_set_main_board.csv +0 -0
  110. {settfex-0.26.1 → settfex-0.26.3}/examples/set/thailand_stock_universe.csv +0 -0
  111. {settfex-0.26.1 → settfex-0.26.3}/examples/tfex/01_series_list.ipynb +0 -0
  112. {settfex-0.26.1 → settfex-0.26.3}/examples/tfex/02_trading_statistics.ipynb +0 -0
  113. {settfex-0.26.1 → settfex-0.26.3}/examples/tfex/03_underlying_price.ipynb +0 -0
  114. {settfex-0.26.1 → settfex-0.26.3}/examples/thaibma/01_government_yield_curve.ipynb +0 -0
  115. {settfex-0.26.1 → settfex-0.26.3}/settfex/deprecations.py +0 -0
  116. {settfex-0.26.1 → settfex-0.26.3}/settfex/exceptions.py +0 -0
  117. {settfex-0.26.1 → settfex-0.26.3}/settfex/py.typed +0 -0
  118. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/__init__.py +0 -0
  119. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/__init__.py +0 -0
  120. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/company.py +0 -0
  121. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/constants.py +0 -0
  122. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/download.py +0 -0
  123. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/executive_trades.py +0 -0
  124. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/financial_report.py +0 -0
  125. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/sec.py +0 -0
  126. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/sec/utils.py +0 -0
  127. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/__init__.py +0 -0
  128. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/asset_type.py +0 -0
  129. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/constants.py +0 -0
  130. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/earnings_call.py +0 -0
  131. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/holiday.py +0 -0
  132. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/__init__.py +0 -0
  133. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/chart_quotation.py +0 -0
  134. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/composition.py +0 -0
  135. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/index.py +0 -0
  136. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/info.py +0 -0
  137. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/list.py +0 -0
  138. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/index/utils.py +0 -0
  139. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/list.py +0 -0
  140. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/news.py +0 -0
  141. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/__init__.py +0 -0
  142. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/analyst_consensus.py +0 -0
  143. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/board_of_director.py +0 -0
  144. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/chart_quotation.py +0 -0
  145. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/corporate_action.py +0 -0
  146. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/dr_indicative_price.py +0 -0
  147. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/financial/__init__.py +0 -0
  148. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/financial/financial.py +0 -0
  149. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/highlight_data.py +0 -0
  150. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/info.py +0 -0
  151. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/latest_historical_trading.py +0 -0
  152. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/nvdr_holder.py +0 -0
  153. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/price_performance.py +0 -0
  154. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/profile_company.py +0 -0
  155. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/profile_dr.py +0 -0
  156. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/profile_stock.py +0 -0
  157. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/shareholder.py +0 -0
  158. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/stock.py +0 -0
  159. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/trading_stat.py +0 -0
  160. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/set/stock/utils.py +0 -0
  161. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/tfex/__init__.py +0 -0
  162. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/tfex/constants.py +0 -0
  163. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/tfex/list.py +0 -0
  164. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/tfex/trading_statistics.py +0 -0
  165. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/tfex/underlying_price.py +0 -0
  166. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/__init__.py +0 -0
  167. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/availability.py +0 -0
  168. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/constants.py +0 -0
  169. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/history.py +0 -0
  170. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/thaibma.py +0 -0
  171. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/utils.py +0 -0
  172. {settfex-0.26.1 → settfex-0.26.3}/settfex/services/thaibma/yield_curve.py +0 -0
  173. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/__init__.py +0 -0
  174. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/http.py +0 -0
  175. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/parsing.py +0 -0
  176. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/session_cache.py +0 -0
  177. {settfex-0.26.1 → settfex-0.26.3}/settfex/utils/youtube_transcript.py +0 -0
  178. {settfex-0.26.1 → settfex-0.26.3}/tests/__init__.py +0 -0
  179. {settfex-0.26.1 → settfex-0.26.3}/tests/conftest.py +0 -0
  180. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/api_surface.json +0 -0
  181. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/analyst_consensus.json +0 -0
  182. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/dr_profile.json +0 -0
  183. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/earnings_call_item.json +0 -0
  184. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/highlight_data.json +0 -0
  185. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/holiday_calendar.json +0 -0
  186. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/index_list_response.json +0 -0
  187. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/news_search_response.json +0 -0
  188. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/sec_company_match.json +0 -0
  189. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/sec_executive_trade.json +0 -0
  190. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/sec_executive_trade_report.json +0 -0
  191. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/stock_info.json +0 -0
  192. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/stock_list_response.json +0 -0
  193. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/tfex_series_list_response.json +0 -0
  194. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/tfex_trading_statistics.json +0 -0
  195. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/tfex_underlying_price.json +0 -0
  196. {settfex-0.26.1 → settfex-0.26.3}/tests/golden/model_contract/yield_curve.json +0 -0
  197. {settfex-0.26.1 → settfex-0.26.3}/tests/integration/__init__.py +0 -0
  198. {settfex-0.26.1 → settfex-0.26.3}/tests/integration/conftest.py +0 -0
  199. {settfex-0.26.1 → settfex-0.26.3}/tests/integration/test_live_endpoints.py +0 -0
  200. {settfex-0.26.1 → settfex-0.26.3}/tests/services/__init__.py +0 -0
  201. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/__init__.py +0 -0
  202. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/derive_r59_fixtures.py +0 -0
  203. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/derive_th_fixtures.py +0 -0
  204. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures.py +0 -0
  205. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/README.md +0 -0
  206. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/capital_indirection_en.html +0 -0
  207. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/en_mother_fs_h1_2025.html +0 -0
  208. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/en_ptt_56_1.html +0 -0
  209. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/en_ptt_56_2.html +0 -0
  210. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/en_ptt_fs_h1_2025.html +0 -0
  211. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/en_ptt_viewmore_56_2.html +0 -0
  212. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/idisc_505_error_page.html +0 -0
  213. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000082610_th.json +0 -0
  214. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000092610_th.json +0 -0
  215. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000102610_th.json +0 -0
  216. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000142610_th.json +0 -0
  217. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000152610_th.json +0 -0
  218. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000392610_th.json +0 -0
  219. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000452610_th.json +0 -0
  220. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000522610_th.json +0 -0
  221. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000532609_th.json +0 -0
  222. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592000542609_th.json +0 -0
  223. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001242610_th.json +0 -0
  224. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001262610_th.json +0 -0
  225. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001352609_th.json +0 -0
  226. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001352610_th.json +0 -0
  227. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001372609_th.json +0 -0
  228. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001432610_en.json +0 -0
  229. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592001432610_th.json +0 -0
  230. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592002622609_th.json +0 -0
  231. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592002632609_th.json +0 -0
  232. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592002772609_th.json +0 -0
  233. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592002782609_th.json +0 -0
  234. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592002882609_th.json +0 -0
  235. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592002892609_th.json +0 -0
  236. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592003112609_th.json +0 -0
  237. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592003122609_th.json +0 -0
  238. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592003452609_th.json +0 -0
  239. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592003462609_th.json +0 -0
  240. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592003632609_th.json +0 -0
  241. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592003652609_th.json +0 -0
  242. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004042609_th.json +0 -0
  243. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004052609_th.json +0 -0
  244. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004192609_th.json +0 -0
  245. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004202609_th.json +0 -0
  246. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004532609_th.json +0 -0
  247. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004542609_th.json +0 -0
  248. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004802609_th.json +0 -0
  249. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004812609_th.json +0 -0
  250. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592004992609_th.json +0 -0
  251. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592005002609_th.json +0 -0
  252. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592005172609_th.json +0 -0
  253. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592005182609_th.json +0 -0
  254. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/detail_592005512609_th.json +0 -0
  255. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/en_default_20261007.html +0 -0
  256. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_capped_rcv_20261002.html +0 -0
  257. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_default_20261007.html +0 -0
  258. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_edge_rows.html +0 -0
  259. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_empty.html +0 -0
  260. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_kcg_txn_202609.html +0 -0
  261. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_sep_pairs.html +0 -0
  262. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/r59/th_spali_txn_202609.html +0 -0
  263. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/th_cpall_viewmore_56_1.html +0 -0
  264. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/th_mother_fs_h1_2025.html +0 -0
  265. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/th_ptt_56_1.html +0 -0
  266. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/th_ptt_56_2.html +0 -0
  267. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/fixtures_sec/th_ptt_fs_h1_2025.html +0 -0
  268. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_code_isolation.py +0 -0
  269. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_company.py +0 -0
  270. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_download.py +0 -0
  271. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_download_evidence.py +0 -0
  272. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_download_indirection.py +0 -0
  273. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_download_result.py +0 -0
  274. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_executive_trades.py +0 -0
  275. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_financial_report.py +0 -0
  276. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_financial_report_accounting.py +0 -0
  277. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_financial_report_th.py +0 -0
  278. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_listing_transport.py +0 -0
  279. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_sec.py +0 -0
  280. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_utils.py +0 -0
  281. {settfex-0.26.1 → settfex-0.26.3}/tests/services/sec/test_view_more_slugs.py +0 -0
  282. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/__init__.py +0 -0
  283. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/index/__init__.py +0 -0
  284. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/index/test_chart_quotation.py +0 -0
  285. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/index/test_composition.py +0 -0
  286. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/index/test_index.py +0 -0
  287. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/index/test_info.py +0 -0
  288. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/index/test_list.py +0 -0
  289. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/__init__.py +0 -0
  290. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/financial/__init__.py +0 -0
  291. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/financial/test_financial.py +0 -0
  292. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/test_analyst_consensus.py +0 -0
  293. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/test_chart_quotation.py +0 -0
  294. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/test_dr_indicative_price.py +0 -0
  295. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/test_info.py +0 -0
  296. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/test_latest_historical_trading.py +0 -0
  297. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/stock/test_profile_dr.py +0 -0
  298. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_asset_type.py +0 -0
  299. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_board_of_director.py +0 -0
  300. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_client.py +0 -0
  301. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_corporate_action.py +0 -0
  302. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_earnings_call.py +0 -0
  303. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_historical.py +0 -0
  304. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_holiday.py +0 -0
  305. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_list.py +0 -0
  306. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_listed_symbol.py +0 -0
  307. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_news.py +0 -0
  308. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_profile_company.py +0 -0
  309. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_realtime.py +0 -0
  310. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_shareholder.py +0 -0
  311. {settfex-0.26.1 → settfex-0.26.3}/tests/services/set/test_symbol_suggestion.py +0 -0
  312. {settfex-0.26.1 → settfex-0.26.3}/tests/services/test_fault_matrix.py +0 -0
  313. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/__init__.py +0 -0
  314. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/test_client.py +0 -0
  315. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/test_historical.py +0 -0
  316. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/test_list.py +0 -0
  317. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/test_realtime.py +0 -0
  318. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/test_trading_statistics.py +0 -0
  319. {settfex-0.26.1 → settfex-0.26.3}/tests/services/tfex/test_underlying_price.py +0 -0
  320. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/__init__.py +0 -0
  321. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/fixtures.py +0 -0
  322. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/test_availability.py +0 -0
  323. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/test_history.py +0 -0
  324. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/test_thaibma.py +0 -0
  325. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/test_utils.py +0 -0
  326. {settfex-0.26.1 → settfex-0.26.3}/tests/services/thaibma/test_yield_curve.py +0 -0
  327. {settfex-0.26.1 → settfex-0.26.3}/tests/test_deprecations.py +0 -0
  328. {settfex-0.26.1 → settfex-0.26.3}/tests/test_documented_exceptions.py +0 -0
  329. {settfex-0.26.1 → settfex-0.26.3}/tests/test_impersonate_target.py +0 -0
  330. {settfex-0.26.1 → settfex-0.26.3}/tests/test_model_contract.py +0 -0
  331. {settfex-0.26.1 → settfex-0.26.3}/tests/test_not_found_taxonomy.py +0 -0
  332. {settfex-0.26.1 → settfex-0.26.3}/tests/test_public_api_surface.py +0 -0
  333. {settfex-0.26.1 → settfex-0.26.3}/tests/test_readme_links.py +0 -0
  334. {settfex-0.26.1 → settfex-0.26.3}/tests/test_typing_surface.py +0 -0
  335. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/__init__.py +0 -0
  336. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_blocked_error.py +0 -0
  337. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_formatting.py +0 -0
  338. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_http.py +0 -0
  339. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_logging.py +0 -0
  340. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_parsing.py +0 -0
  341. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_session_cache.py +0 -0
  342. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_validation.py +0 -0
  343. {settfex-0.26.1 → settfex-0.26.3}/tests/utils/test_youtube_transcript.py +0 -0
@@ -59,7 +59,12 @@ jobs:
59
59
  cache-dependency-glob: "uv.lock"
60
60
 
61
61
  - run: uv python install 3.12
62
- - run: uv sync --group dev --frozen
62
+ # --all-extras: pip-audit inspects what is INSTALLED, and the dev group alone leaves out
63
+ # the `examples` extra (jupyter, notebook, matplotlib), so its whole tree went unaudited.
64
+ # Found 2026-11-02: a full-lock audit showed 103 advisories in 9 packages there, while this
65
+ # job printed "No known vulnerabilities found". (`--all-groups` would not have helped: groups
66
+ # are not extras.) The bandit job keeps the dev sync, because it scans settfex/ itself.
67
+ - run: uv sync --group dev --all-extras --frozen
63
68
 
64
69
  # Non-blocking: surfaces dependency CVEs for triage without blocking PRs.
65
70
  # Some advisories are transitive or not-yet-fixed upstream (e.g. no fix
@@ -7,6 +7,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.26.3] - 2026-11-02
11
+
12
+ Cookie hardening for the session cache. No API change; one extra warm-up per site after upgrading.
13
+
14
+ ### Security
15
+
16
+ - **A cached session's cookies are sent only to the domain they were issued for**
17
+ (`settfex.utils.session_manager`). The cache kept only name → value, and a restore set each
18
+ cookie with **no domain**. curl_cffi binds a domain-less cookie to the host of the first request
19
+ that carries it, so the first request after a restore decided where a site's cookies went, even to
20
+ a foreign host. A loopback test (two hostnames resolved to 127.0.0.1) showed the restored SET
21
+ cookies reaching `attacker.example` on 0.26.2.
22
+ - The cache now stores each cookie's domain, host-only flag, path, secure flag and expiry
23
+ (`cookie_jar`), and a restore rebuilds exactly that. It keeps writing the plain `cookies` map, so
24
+ 0.26.1/0.26.2 processes sharing the directory still read it.
25
+ - An entry from 0.26.2 or older (no `cookie_jar`) is a cache miss: one anonymous warm-up after
26
+ upgrading, then the row is rewritten. So is a row holding a malformed cookie or one outside the
27
+ site's own domain (`set.or.th`, `tfex.co.th`, `settrade.com`).
28
+ - Verified live on 2026-11-02, 12 requests in all. First, one warm-up per site showed what each
29
+ site issues: `.set.or.th` / `.tfex.co.th` / `.settrade.com`, plus a host-only `charlot` on the
30
+ `www.` host. Then a cold process (warm-up, save, one real call per site) and a second process
31
+ restoring from that cache with no warm-up; all six calls returned data.
32
+ - **`get_session_for_url()` matches the URL's hostname, not a substring of the whole URL.**
33
+ `https://evil.example/?next=www.settrade.com` used to route to the Settrade session, and
34
+ `settrade.com.evil.example` would have too. A host must now equal the site's domain or be a
35
+ subdomain of it; anything else uses the SET session, as before.
36
+
37
+ ## [0.26.2] - 2026-11-02
38
+
39
+ Two logging fixes, and a Security workflow that now audits every extra. No API change.
40
+
41
+ ### Fixed
42
+
43
+ - **With settfex logging enabled, a failed request whose error text contained braces raised
44
+ `KeyError` instead of its own error** (`settfex.utils.data_fetcher`). The standalone request path
45
+ logged with `logger.error(f"...{e}", exc_info=True)`. `exc_info` is a stdlib-logging argument:
46
+ loguru treats any keyword as a format argument and ran `str.format()` on the already-interpolated
47
+ message, so an error such as `"... {'k': 1} ..."` made the logging call itself raise. That
48
+ replaced the real error, which was never re-raised. The error is now passed as an argument
49
+ (`logger.error("Request failed: {}", e)`). No traceback is logged, deliberately: with
50
+ `setup_logger()`'s `diagnose=True` a traceback would print frame locals. Only reachable after
51
+ `logger.enable("settfex")` or `setup_logger()`, because settfex logging has been off by default
52
+ since 0.24.2. Found while comparing security findings with a sibling library.
53
+
54
+ ### Security
55
+
56
+ - **`setup_logger()` no longer prints variable values in logged tracebacks**
57
+ (`settfex.utils.logging`). Both sinks it adds (console and `log_file`) used loguru's
58
+ `diagnose=True`, which annotates every traceback frame with its local variables. loguru itself
59
+ advises against that in production, because it leaks data: a caller's `logger.exception()` whose
60
+ traceback ran through a frame holding a cookie or token would write the value to the console and
61
+ the log file. Both sinks now use `diagnose=False`; `backtrace=True` stays, because it only
62
+ extends the frame list. loguru's own default stderr handler belongs to the host process, and
63
+ `setup_logger()` still never removes a handler it did not add. Remove it yourself if you need the
64
+ same guarantee there. A test drives a real `logger.exception()` through a frame holding a secret
65
+ and asserts it reaches neither sink.
66
+ - **The Security workflow now audits every extra** (`--all-extras`). It used to sync only the dev
67
+ group, so the `examples` extra (jupyter, notebook, matplotlib) was never audited. A full-lock
68
+ audit found 103 advisories in 9 packages there, all now bumped in `uv.lock` (pillow 13.0.0,
69
+ tornado 6.6, mistune 3.4.0, soupsieve 2.9.2, nbconvert 7.17.2, anyio 4.14.2, bleach 6.4.0,
70
+ fonttools 4.68.0, jupyter-server 2.21.1). Lock-only: the published wheel's requirements are
71
+ unchanged, and `pip install settfex[examples]` always resolved current versions.
72
+
10
73
  ## [0.26.1] - 2026-11-02
11
74
 
12
75
  **Security: settfex no longer depends on `diskcache`, and nothing it caches is ever unpickled.**
@@ -550,6 +550,7 @@ See [`CHANGELOG.md`](CHANGELOG.md) for the full, versioned release history — t
550
550
  - **Over plain HTTP the quote block serves the BEST bid/offer level only:** `bids`/`offers` come back with one entry each, not the 5-level ladder shown on the set.or.th page (that depth is websocket-fed). Ladder `price` arrives as a **string** (`"44.75"`) and is coerced by the shared `BidOffer` model, which `stock/info.py` imports from `index/composition.py` rather than duplicating.
551
551
  - **A stock-info 404 means "unknown symbol" — unlike the DR-profile 404:** `/api/set/stock/{sym}/info` answers an unknown ticker with HTTP 404 `{"message": "Invalid Stock Name"}` and resolves every real one, so `SymbolNotFoundError` is raised **with** the "did you mean?" suggester enabled (the opposite of `/api/set/dr/{sym}/profile`, which 404s for valid non-DRs and must pass `suggest=False`).
552
552
  - **The session cache no longer unpickles (0.26.1) — and the `0700` rule stays, for a different reason:** until 0.26.1 the store was `diskcache`, which reads values back with **pickle** (CVE-2025-69872 / PYSEC-2026-2447, **no fixed release**, upstream dormant since 2023), so write access to `~/.settfex/cache` was code execution in the caller's process, and every consumer's pip-audit flagged it on a *runtime* dependency. `settfex/utils/session_cache.py` is now stdlib **`sqlite3` holding JSON text** (`sessions.sqlite3`, WAL, created `0600`): `json.loads` on read, a row that is not a JSON object is a miss, and the old `cache.db` is **never opened** (one extra warm-up after upgrading; an INFO line says it can be deleted). The public API is unchanged. **Do not reintroduce a pickling store.** The directory rule is unchanged because the cookies are credentials: `_secure_cache_dir()` creates it `0700` and **chmods an existing default one in place** (logged at INFO); a directory the caller passed is created `0700` when new but, if it already exists group/other-writable, is **reported and left alone** — a shared cache can be deliberate. Windows is skipped (POSIX bits do not express this), and every permission step is inside `try/except OSError`. Tests pin the permissions, the no-unpickle property and the store's behaviour in `tests/utils/test_session_cache.py`.
553
+ - **Cached cookies are restored WITH their domain (0.26.3) — never restore one without it:** curl_cffi binds a domain-less cookie to the host of the FIRST request that carries it (`Cookies.get_cookies_for_curl` fills an empty domain from the current request), so until 0.26.3 — when the cache kept name → value only — the first request after a restore decided where a site's Incapsula cookies went, foreign host included (a loopback test proved it). The cache row now carries `cookie_jar` (domain, host-only flag, path, secure, expiry) and `_cookie_from_cache` rebuilds an exact `http.cookiejar.Cookie`; a row without it (≤ 0.26.2), with a malformed cookie, or with a domain outside the site's own is a **miss**, never a guess. The plain `cookies` map is still written for 0.26.1/0.26.2 readers. Live shape (2026-11-02): `.set.or.th` / `.tfex.co.th` / `.settrade.com` for `visid_incap_*`/`incap_ses_*`, host-only `www.<site>` for `charlot`. ⚠️ **Test trap:** with plain `localhost` vs `127.0.0.1` as the two hosts a domain-less cookie reaches NEITHER — use dotted names via `CURLOPT_RESOLVE`. `get_session_for_url()` likewise matches the **hostname** (equal or subdomain), not a substring of the URL.
553
554
  - **SEC serves FOUR download-URL shapes; two of them were silently dropping live filings:** `classify_download_href` knew `Download?FILEID=<path>` and `ipos/Common/IPOSGetFile.aspx?id=`. **Key Financial Ratio** rows use two more, and both fell through to "not a download link" and made the row vanish — live-probed 2026-09-20 on CPALL, both real downloads: (1) recent rows (2026 Q1/Q2) link through `/public/idisc/Views/FinancialStatementDownload?query=<opaque base64>`, answering `application/zip` — a **134 KB zip of the real PDFs**; (2) older rows (2018, 2019) link through `/public/idisc/views/viewdoc?…&TransId=<id>&FileSeq=<n>`, answering `application/.tif` — a **36 KB scan of the original**. Mapped now as `file_id="fsdl:<blob>"` / `"viewdoc:<id>-<n>"`, both `file_kind=None` (neither URL states a type; `Content-Disposition` names the file at download time). After the fix, CPALL 2015-2026 returns **177 documents with `completeness()` exact in all five categories** — `key_financial_ratio` was `(13, 15)`. ⚠️ **Three things this should teach the next reader.** (a) **It falsifies the reporting issue's own finding:** its corpus scan of 39 captured pages found *zero* natural instances of a dropped row and stated P1 "has not been observed in the wild"; the first two live runs of the new accounting found four. A captured corpus can only show what was captured. (b) **The window is load-bearing:** a narrow recent window passed clean while the 2018/2019 rows were being dropped — **old filings use old URL shapes**, so a probe that only checks recent data cannot see them. (c) **Do NOT generalise the allowlist** into "any link under /public/idisc/ with a query is a download": the "display all results" ViewMore link has exactly that shape, and would become a phantom filing in every truncated section. Expect the list to grow; `ListingAccounting.no_link` is the mechanism that makes the next one visible, and a test pins the ViewMore link as not-a-download. Note `_fallback_filename` keys on the **colon**, not on an `ipos:` prefix: a real FILEID path never contains one, so every synthetic id is safely excluded from being sliced like a path.
554
555
  - **The SEC LISTING path checks its HTTP status now — and a ViewMore failure DEGRADES rather than raising (issue #131):** `_run_search` used to return `post_resp.text` without ever reading `status_code`, so an error page parsed to zero rows and came back as `[]` with `has_losses == False` — indistinguishable from an issuer that filed nothing, and intermittent, so a backfill recorded the window as covered. Evidenced by a real **HTTP 505** from the listing host (2026-09-20). Two rules: non-2xx → `FetchError`; a 2xx body with **no result table and no section heading** → `ParseError`. The content rule is deliberately the weakest one that separates the populations, because the case it must never trip is a **genuinely empty listing** — a test pins it against every page this repo holds. It does **not** key on `ctl00_CPH_pnlControl`: the real ViewMore capture has that id and the trimmed `FS_VIEWMORE_HTML` constant does not, so a panel-id rule would call a legitimate page an error. ⚠️ **The severity ladder differs by leg, on purpose.** The POST leg raises (a total loss — nothing to fall back on). A **ViewMore** page is different: it *replaces* its section's inline rows, so 0.22.0's unconditional replacement meant a failing page **deleted the whole section, inline rows included, in silence**. A broken ViewMore is a *partial* loss, so it now keeps the inline rows, warns, and lets `completeness()` show the shortfall. `_map_rows` additionally refuses a **zero-row** input: within this package that can only be a non-listing body, since every captured page carries at least the placeholder row an empty section serves. ⚠️ **U-7 (0.25.0): a ViewMore page must never REDUCE the row set — and until 0.25.0 a *successful* one could.** Two ways, both silent: (1) a page that mapped to fewer documents than the inline rows replaced them anyway (no comparison), so a short or placeholder-only page deleted rows with `has_losses` still `False`; (2) a page whose `_map_rows` raised (`ParseError`/`IncompleteListingError`) escaped the loop, and the per-code gather then failed the **whole report code**, taking every sibling category's inline rows with it. Both now degrade exactly like an unusable page (`DegradedSection`, inline rows kept). The rule is a **count** (ViewMore docs for the category ≥ inline docs), **not identity** — a superset check by file id would flip the synthetic test pairs and misfire on `fsdl:` ids, which may be minted per request. On the degrade path `reported.update`/`supersede` are skipped, so `is_balanced` holds and the inline page's reported count stays for `completeness()`; on the replace path only the replaced category's reported count moves.
555
556
  - **The live Thai `fs-kf` ViewMore page has been answering HTTP 500 since at least 2026-09-20 — an UPSTREAM bug, and it is why the degrade path exists:** probed 3× each, `th/fs-kf` returned 500 every time while `th/fs-norm`, `th/fs-mda` and all three `en/*` returned 200. On 0.22.0 this silently removed CPALL's entire Thai Key Financial Ratio section; now the listing returns 177 documents with `key_financial_ratio: (10, 15)` stated in `completeness()` plus two WARNINGs. **If you see a Thai KFR shortfall, check whether SEC has fixed their page before looking in settfex.**
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: settfex
3
- Version: 0.26.1
3
+ Version: 0.26.3
4
4
  Summary: Async Python library for fetching real-time and historical data from the Stock Exchange of Thailand (SET) and Thailand Futures Exchange (TFEX)
5
5
  Project-URL: Homepage, https://github.com/lumduan/settfex
6
6
  Project-URL: Documentation, https://github.com/lumduan/settfex#readme
@@ -255,15 +255,18 @@ await manager.ensure_initialized()
255
255
  ### Cache Location
256
256
 
257
257
  ```
258
- ~/.settfex/cache/
259
- ├── cache.db # SQLite index
260
- ├── 00/ # Data shards
261
- │ ├── 00.val
262
- │ ├── 01.val
263
- │ └── ...
264
- └── ...
258
+ ~/.settfex/cache/ # 0700
259
+ ├── sessions.sqlite3 # 0600 - one row per site/browser, JSON text (since 0.26.1)
260
+ ├── sessions.sqlite3-wal # SQLite write-ahead log
261
+ ├── sessions.sqlite3-shm
262
+ └── cache.db, 00/ ... # only if upgraded from <= 0.26.0: the old diskcache store,
263
+ # never opened again; safe to delete
265
264
  ```
266
265
 
266
+ Each row holds a site's cookies **with the domain, host-only flag, path, secure flag and expiry
267
+ they were issued for** (`cookie_jar`, since 0.26.3), plus the plain `cookies` name → value map that
268
+ 0.26.1/0.26.2 read.
269
+
267
270
  ### Directory Permissions
268
271
 
269
272
  The cache directory is created **`0700`** (owner only), and an existing `~/.settfex/cache` left
@@ -279,6 +282,16 @@ write access to this directory meant code execution in your process. The store i
279
282
  `sqlite3` holding JSON text: a row that is not a JSON object is a cache miss, never code. The old
280
283
  `cache.db` is never opened; delete it if you like. The session warms up once after the upgrade.
281
284
 
285
+ **Each cookie is restored with the domain it was issued for (since 0.26.3).** Until 0.26.3 the cache
286
+ kept only name → value and restored each cookie with no domain. curl_cffi binds such a cookie to the
287
+ host of the **first** request that carries it, so the first request after a restore decided where a
288
+ site's cookies went, even to another host. Each cookie now comes back with its own attributes
289
+ (a real SET warm-up yields `.set.or.th` for the Incapsula cookies and host-only `www.set.or.th` for
290
+ `charlot`), so it is sent to that domain and nowhere else. An entry without those attributes,
291
+ written by 0.26.2 or older, is treated as a miss: one anonymous warm-up, then the row is rewritten.
292
+ A cookie whose domain is not the site's own is refused the same way, so a planted row cannot steer a
293
+ site's cookies to another host.
294
+
282
295
  A directory **you** passed as `cache_dir` is treated differently: it is created `0700` if new, but
283
296
  if it already exists and is group/other-**writable**, settfex logs a warning and
284
297
  **leaves the mode alone**. A shared cache may be deliberate, and silently breaking that layout
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "settfex"
3
- version = "0.26.1"
3
+ version = "0.26.3"
4
4
  description = "Async Python library for fetching real-time and historical data from the Stock Exchange of Thailand (SET) and Thailand Futures Exchange (TFEX)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -64,7 +64,7 @@ Usage:
64
64
  >>> asyncio.run(main())
65
65
  """
66
66
 
67
- __version__ = "0.26.1"
67
+ __version__ = "0.26.3"
68
68
  __author__ = "batt"
69
69
  __license__ = "MIT"
70
70
 
@@ -288,7 +288,11 @@ class AsyncDataFetcher:
288
288
  logger.debug(f"Request completed: status={response.status_code}, url={url}")
289
289
  return response
290
290
  except Exception as e:
291
- logger.error(f"Request failed: {e}", exc_info=True)
291
+ # The error goes in as an ARGUMENT, so loguru never reads braces in its text as
292
+ # format fields. (`exc_info=True` here made loguru str.format() the f-string, and
293
+ # an error text like "{'k': 1}" raised KeyError in place of the real error.)
294
+ # No traceback on purpose: loguru's diagnose mode would print frame locals.
295
+ logger.error("Request failed: {}", e)
292
296
  raise
293
297
 
294
298
  async def fetch(
@@ -108,7 +108,12 @@ def setup_logger(
108
108
  colorize=colorize,
109
109
  filter=filter,
110
110
  backtrace=True,
111
- diagnose=True,
111
+ # diagnose=False: loguru's diagnose mode prints every frame's LOCAL VARIABLES in a
112
+ # logged traceback, and loguru itself advises turning it off in production because
113
+ # that leaks data. A caller's logger.exception() whose traceback passes through
114
+ # settfex frames would otherwise print what those frames hold. backtrace=True only
115
+ # extends the frame list; it prints no values.
116
+ diagnose=False,
112
117
  )
113
118
  )
114
119
 
@@ -127,7 +132,7 @@ def setup_logger(
127
132
  compression="zip",
128
133
  filter=filter,
129
134
  backtrace=True,
130
- diagnose=True,
135
+ diagnose=False, # see the console handler above
131
136
  )
132
137
  )
133
138
 
@@ -16,8 +16,10 @@ Key features:
16
16
 
17
17
  import asyncio
18
18
  import time
19
+ from http.cookiejar import Cookie
19
20
  from pathlib import Path
20
21
  from typing import Any, ClassVar
22
+ from urllib.parse import urlsplit
21
23
 
22
24
  from curl_cffi import requests
23
25
  from loguru import logger
@@ -36,14 +38,82 @@ WARMUP_URLS: dict[str, tuple[str, str]] = {
36
38
  "settrade": ("https://www.settrade.com/th/home", "Settrade"),
37
39
  }
38
40
 
39
- # Host substring -> warmup site, for get_session_for_url(). Anything unmatched uses the SET
40
- # warmup. Order is irrelevant today (no host matches two entries) but the tuple keeps it stable.
41
+ # Registrable domain -> warmup site, for get_session_for_url(). A URL is matched on its HOSTNAME:
42
+ # the host equals the domain or ends with "." + domain. Until 0.26.3 this was a substring test on
43
+ # the whole URL, so "https://evil.example/?next=www.settrade.com" routed to the Settrade session.
44
+ # Anything unmatched uses the SET warmup. Order is irrelevant (no host matches two entries).
41
45
  _URL_WARMUP_SITES: tuple[tuple[str, str], ...] = (
42
46
  ("tfex.co.th", "tfex"),
43
47
  ("settrade.com", "settrade"),
44
48
  )
45
49
 
46
50
 
51
+ def _host_in_domain(host: str, domain: str) -> bool:
52
+ """True when ``host`` is ``domain`` itself or a subdomain of it (never a mere suffix)."""
53
+ host = host.lower().lstrip(".")
54
+ return host == domain or host.endswith("." + domain)
55
+
56
+
57
+ def _site_cookie_domain(warmup_site: str) -> str:
58
+ """The domain a site's cookies must belong to: its warmup host minus a leading ``www.``."""
59
+ warmup_url, _ = WARMUP_URLS.get(warmup_site, WARMUP_URLS["set"])
60
+ host = urlsplit(warmup_url).hostname or ""
61
+ return host.removeprefix("www.")
62
+
63
+
64
+ def _cookie_to_cache(cookie: Cookie) -> dict[str, Any]:
65
+ """The attributes that decide WHERE a cookie is sent, so a restore sends it nowhere else."""
66
+ return {
67
+ "name": cookie.name,
68
+ "value": cookie.value,
69
+ "domain": cookie.domain,
70
+ "domain_specified": cookie.domain_specified,
71
+ "path": cookie.path,
72
+ "secure": cookie.secure,
73
+ "expires": cookie.expires,
74
+ }
75
+
76
+
77
+ def _cookie_from_cache(entry: Any, site_domain: str) -> Cookie | None:
78
+ """Rebuild one cached cookie, or ``None`` if the entry is malformed or off-site.
79
+
80
+ A cookie without a domain must never be restored: curl_cffi binds a domain-less cookie to
81
+ the host of the FIRST request that carries it (``Cookies.get_cookies_for_curl``), wherever
82
+ that request goes. A domain outside the site's own is refused as well, so a cache entry
83
+ cannot direct a site's cookies to another host.
84
+ """
85
+ if not isinstance(entry, dict):
86
+ return None
87
+ name, value, domain = entry.get("name"), entry.get("value"), entry.get("domain")
88
+ path = entry.get("path") or "/"
89
+ expires = entry.get("expires")
90
+ if not (isinstance(name, str) and name and isinstance(value, str)):
91
+ return None
92
+ if not (isinstance(domain, str) and domain and _host_in_domain(domain, site_domain)):
93
+ return None
94
+ if not isinstance(path, str) or (expires is not None and not isinstance(expires, int)):
95
+ return None
96
+ domain_specified = bool(entry.get("domain_specified"))
97
+ return Cookie(
98
+ version=0,
99
+ name=name,
100
+ value=value,
101
+ port=None,
102
+ port_specified=False,
103
+ domain=domain,
104
+ domain_specified=domain_specified,
105
+ domain_initial_dot=domain.startswith("."),
106
+ path=path,
107
+ path_specified=True,
108
+ secure=bool(entry.get("secure")),
109
+ expires=expires,
110
+ discard=expires is None,
111
+ comment=None,
112
+ comment_url=None,
113
+ rest={},
114
+ )
115
+
116
+
47
117
  class SessionManager:
48
118
  """
49
119
  Singleton session manager for curl_cffi with automatic cookie persistence and caching.
@@ -206,23 +276,41 @@ class SessionManager:
206
276
  cache.delete(self._cache_key)
207
277
  return False
208
278
 
209
- # Load cookies from cache
210
- cookies_dict = cached.get("cookies", {})
211
279
  browser = cached.get("browser", self.browser)
212
280
 
213
- if not cookies_dict:
214
- logger.warning("Cached session has no cookies")
281
+ # Restore cookies WITH the domain/path/flags they were issued for (0.26.3). An entry
282
+ # written by 0.26.2 or older holds only name -> value, and restoring that would bind
283
+ # the cookies to whatever host the first request goes to, so it is a cache miss:
284
+ # one anonymous warm-up, then the entry is rewritten in this format.
285
+ entries = cached.get("cookie_jar")
286
+ if not isinstance(entries, list) or not entries:
287
+ if cached.get("cookies"):
288
+ logger.info(
289
+ "Cached session predates cookie domains (settfex <= 0.26.2) - "
290
+ "re-warming once instead of restoring cookies without a domain"
291
+ )
292
+ else:
293
+ logger.warning("Cached session has no cookies")
294
+ return False
295
+
296
+ site_domain = _site_cookie_domain(self.warmup_site)
297
+ cookies = [_cookie_from_cache(entry, site_domain) for entry in entries]
298
+ if any(cookie is None for cookie in cookies):
299
+ logger.warning(
300
+ f"Cached session has a malformed or off-site cookie (site domain "
301
+ f"{site_domain}) - re-warming instead of restoring it"
302
+ )
215
303
  return False
216
304
 
217
305
  # Create new session with cached cookies
218
306
  if self._session is None:
219
307
  self._session = requests.Session()
220
308
 
221
- # Restore cookies to session
222
- for name, value in cookies_dict.items():
223
- self._session.cookies.set(name, value)
309
+ for cookie in cookies:
310
+ assert cookie is not None # narrowed by the any() check above
311
+ self._session.cookies.jar.set_cookie(cookie)
224
312
 
225
- cookie_count = len(cookies_dict)
313
+ cookie_count = len(cookies)
226
314
  age = time.time() - cached.get("cached_at", 0)
227
315
  logger.success(
228
316
  f"✓ Loaded session from cache: {cookie_count} cookies "
@@ -267,10 +355,16 @@ class SessionManager:
267
355
  logger.warning("No cookies to cache")
268
356
  return
269
357
 
358
+ # The full attributes, so a restore sends each cookie only where it was issued for.
359
+ # "cookies" (name -> value) stays alongside for settfex 0.26.1/0.26.2 processes
360
+ # reading the same cache directory.
361
+ cookie_jar = [_cookie_to_cache(cookie) for cookie in self._session.cookies.jar]
362
+
270
363
  # Save to cache
271
364
  cache.set(
272
365
  self._cache_key,
273
366
  {
367
+ "cookie_jar": cookie_jar,
274
368
  "cookies": cookies_dict,
275
369
  "browser": self.browser,
276
370
  "warmup_time": self._last_warmup_time,
@@ -518,8 +612,10 @@ async def get_session_for_url(url: str, browser: str = "chrome120") -> SessionMa
518
612
  >>> session = await get_session_for_url("https://www.settrade.com/api/set-fund/...")
519
613
  >>> # Automatically uses Settrade warmup
520
614
  """
521
- # Auto-detect warmup site based on URL host; anything unmatched uses the SET warmup.
522
- lowered = url.lower()
523
- warmup_site = next((site for host, site in _URL_WARMUP_SITES if host in lowered), "set")
615
+ # Auto-detect the warmup site from the URL's HOSTNAME; anything unmatched uses the SET warmup.
616
+ host = urlsplit(url).hostname or ""
617
+ warmup_site = next(
618
+ (site for domain, site in _URL_WARMUP_SITES if _host_in_domain(host, domain)), "set"
619
+ )
524
620
 
525
621
  return await get_shared_session(browser=browser, warmup_site=warmup_site)
@@ -581,3 +581,36 @@ class TestAsyncDataFetcherPost:
581
581
 
582
582
  assert resp.content == raw
583
583
  assert resp.encoding == "latin1"
584
+
585
+
586
+ class TestRequestFailureLogging:
587
+ """A failed request must re-raise ITS OWN exception, whatever its text contains.
588
+
589
+ The except-branch used to call ``logger.error(f"...{e}", exc_info=True)``. ``exc_info`` is a
590
+ stdlib-logging argument; loguru treats any keyword as a format argument and runs
591
+ ``str.format()`` on the already-interpolated message, so an error text containing braces
592
+ (a JSON fragment, a dict repr) made the LOGGING call raise ``KeyError`` and replace the real
593
+ error. It fired only with settfex logging enabled (disabled by default since 0.24.2).
594
+ """
595
+
596
+ @pytest.mark.asyncio
597
+ async def test_braces_in_the_error_text_do_not_replace_the_error(self) -> None:
598
+ from loguru import logger
599
+
600
+ records: list[str] = []
601
+ logger.enable("settfex")
602
+ sink = logger.add(lambda m: records.append(m.record["message"]), level="ERROR")
603
+ try:
604
+ fetcher = AsyncDataFetcher(config=FetcherConfig(use_session=False, max_retries=0))
605
+ boom = ConnectionError("upstream said {'k': 1} and {0}")
606
+ with (
607
+ patch("settfex.utils.data_fetcher.requests.get", side_effect=boom),
608
+ pytest.raises(ConnectionError) as excinfo,
609
+ ):
610
+ await fetcher._make_request("https://x/y", headers={})
611
+ finally:
612
+ logger.remove(sink)
613
+ logger.disable("settfex")
614
+
615
+ assert excinfo.value is boom, "the logging call must not swap the exception"
616
+ assert records == ["Request failed: upstream said {'k': 1} and {0}"]
@@ -335,3 +335,46 @@ class TestEnableMustComeAfterTheImport:
335
335
  assert "settfex." in log.read_text(encoding="utf-8"), (
336
336
  'logger.enable("settfex") after `import settfex` must make settfex audible'
337
337
  )
338
+
339
+
340
+ class TestSetupLoggerDoesNotPrintFrameLocals:
341
+ """setup_logger()'s sinks run with diagnose=False: a logged traceback carries no values.
342
+
343
+ loguru's diagnose mode annotates every traceback frame with its local variables. A caller's
344
+ ``logger.exception()`` whose traceback passes through a frame holding a secret would write
345
+ that secret to the console and the log file.
346
+ """
347
+
348
+ def test_a_secret_in_a_frame_local_stays_out_of_the_log_file(self, tmp_path: Path) -> None:
349
+ log = tmp_path / "trace.log"
350
+ result = run_in_fresh_interpreter(
351
+ f"""
352
+ from loguru import logger
353
+ from settfex.utils.logging import setup_logger
354
+
355
+ # Drop loguru's own default stderr handler (diagnose=True by loguru's default). It is
356
+ # the host's, and setup_logger() never removes a handler it did not add, so stderr
357
+ # would carry the value through it. This test is about the two sinks settfex adds.
358
+ logger.remove()
359
+ setup_logger(level="DEBUG", log_file={str(log)!r})
360
+
361
+ def send(cookie):
362
+ raise RuntimeError("request failed")
363
+
364
+ def handler():
365
+ session_cookie = "TOPSECRET-incap-value"
366
+ send(session_cookie) # diagnose annotates the names on a traceback line
367
+
368
+ try:
369
+ handler()
370
+ except RuntimeError:
371
+ logger.exception("caller logs the failure")
372
+ logger.remove()
373
+ """,
374
+ tmp_path,
375
+ )
376
+ assert result.returncode == 0, result.stderr
377
+ text = log.read_text(encoding="utf-8")
378
+ assert "RuntimeError: request failed" in text, "the traceback itself must still be logged"
379
+ assert "TOPSECRET" not in text, "diagnose mode printed a frame local into the log file"
380
+ assert "TOPSECRET" not in result.stderr, "diagnose mode printed a frame local to stderr"