rquote 0.3.5__tar.gz → 0.3.6__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 (48) hide show
  1. {rquote-0.3.5 → rquote-0.3.6}/PKG-INFO +1 -1
  2. {rquote-0.3.5 → rquote-0.3.6}/pyproject.toml +1 -1
  3. {rquote-0.3.5 → rquote-0.3.6}/rquote/__init__.py +1 -1
  4. {rquote-0.3.5 → rquote-0.3.6}/rquote/data_sources/sina.py +6 -0
  5. {rquote-0.3.5 → rquote-0.3.6}/rquote/data_sources/tencent.py +7 -4
  6. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/cn_stock.py +1 -1
  7. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils/web.py +5 -0
  8. {rquote-0.3.5 → rquote-0.3.6}/rquote.egg-info/PKG-INFO +1 -1
  9. {rquote-0.3.5 → rquote-0.3.6}/tests/test_api.py +1 -1
  10. {rquote-0.3.5 → rquote-0.3.6}/README.md +0 -0
  11. {rquote-0.3.5 → rquote-0.3.6}/rquote/api/__init__.py +0 -0
  12. {rquote-0.3.5 → rquote-0.3.6}/rquote/api/lists.py +0 -0
  13. {rquote-0.3.5 → rquote-0.3.6}/rquote/api/price.py +0 -0
  14. {rquote-0.3.5 → rquote-0.3.6}/rquote/api/stock_info.py +0 -0
  15. {rquote-0.3.5 → rquote-0.3.6}/rquote/api/tick.py +0 -0
  16. {rquote-0.3.5 → rquote-0.3.6}/rquote/cache/__init__.py +0 -0
  17. {rquote-0.3.5 → rquote-0.3.6}/rquote/cache/base.py +0 -0
  18. {rquote-0.3.5 → rquote-0.3.6}/rquote/cache/memory.py +0 -0
  19. {rquote-0.3.5 → rquote-0.3.6}/rquote/config.py +0 -0
  20. {rquote-0.3.5 → rquote-0.3.6}/rquote/data_sources/__init__.py +0 -0
  21. {rquote-0.3.5 → rquote-0.3.6}/rquote/data_sources/base.py +0 -0
  22. {rquote-0.3.5 → rquote-0.3.6}/rquote/exceptions.py +0 -0
  23. {rquote-0.3.5 → rquote-0.3.6}/rquote/factors/__init__.py +0 -0
  24. {rquote-0.3.5 → rquote-0.3.6}/rquote/factors/technical.py +0 -0
  25. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/__init__.py +0 -0
  26. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/base.py +0 -0
  27. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/factory.py +0 -0
  28. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/future.py +0 -0
  29. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/hk_stock.py +0 -0
  30. {rquote-0.3.5 → rquote-0.3.6}/rquote/markets/us_stock.py +0 -0
  31. {rquote-0.3.5 → rquote-0.3.6}/rquote/parsers/__init__.py +0 -0
  32. {rquote-0.3.5 → rquote-0.3.6}/rquote/parsers/kline.py +0 -0
  33. {rquote-0.3.5 → rquote-0.3.6}/rquote/plots.py +0 -0
  34. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils/__init__.py +0 -0
  35. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils/date.py +0 -0
  36. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils/helpers.py +0 -0
  37. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils/http.py +0 -0
  38. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils/logging.py +0 -0
  39. {rquote-0.3.5 → rquote-0.3.6}/rquote/utils.py +0 -0
  40. {rquote-0.3.5 → rquote-0.3.6}/rquote.egg-info/SOURCES.txt +0 -0
  41. {rquote-0.3.5 → rquote-0.3.6}/rquote.egg-info/dependency_links.txt +0 -0
  42. {rquote-0.3.5 → rquote-0.3.6}/rquote.egg-info/requires.txt +0 -0
  43. {rquote-0.3.5 → rquote-0.3.6}/rquote.egg-info/top_level.txt +0 -0
  44. {rquote-0.3.5 → rquote-0.3.6}/setup.cfg +0 -0
  45. {rquote-0.3.5 → rquote-0.3.6}/tests/test_cache.py +0 -0
  46. {rquote-0.3.5 → rquote-0.3.6}/tests/test_config.py +0 -0
  47. {rquote-0.3.5 → rquote-0.3.6}/tests/test_exceptions.py +0 -0
  48. {rquote-0.3.5 → rquote-0.3.6}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rquote
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch
5
5
  Requires-Python: >=3.6.1
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rquote"
7
- version = "0.3.5"
7
+ version = "0.3.6"
8
8
  description = "Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6.1"
@@ -34,7 +34,7 @@ from . import exceptions
34
34
  from .cache import MemoryCache, Cache
35
35
  from .utils.http import HTTPClient
36
36
 
37
- __version__ = '0.3.5'
37
+ __version__ = '0.3.6'
38
38
 
39
39
  __all__ = [
40
40
  # API函数
@@ -57,6 +57,9 @@ class SinaDataSource(DataSource):
57
57
  return {'data': data}
58
58
  except json.JSONDecodeError as e:
59
59
  raise ParseError(f"Parse error: {e}")
60
+ finally:
61
+ # 确保响应对象被关闭,释放SSL连接
62
+ response.close()
60
63
 
61
64
  def fetch_tick(self, symbols: List[str]) -> Dict[str, Any]:
62
65
  """
@@ -89,4 +92,7 @@ class SinaDataSource(DataSource):
89
92
  return {'data': result}
90
93
  except Exception as e:
91
94
  raise ParseError(f"Parse tick error: {e}")
95
+ finally:
96
+ # 确保响应对象被关闭,释放SSL连接
97
+ response.close()
92
98
 
@@ -12,9 +12,9 @@ from ..exceptions import DataSourceError, ParseError
12
12
  class TencentDataSource(DataSource):
13
13
  """腾讯数据源"""
14
14
 
15
- BASE_URL = "http://web.ifzq.gtimg.cn/appstock/app/newfqkline/get"
16
- BASE_URL_HK = "http://web.ifzq.gtimg.cn/appstock/app/hkfqkline/get"
17
- BASE_URL_US = "http://web.ifzq.gtimg.cn/appstock/app/usfqkline/get"
15
+ BASE_URL = "https://web.ifzq.gtimg.cn/appstock/app/newfqkline/get"
16
+ BASE_URL_HK = "https://web.ifzq.gtimg.cn/appstock/app/hkfqkline/get"
17
+ BASE_URL_US = "https://web.ifzq.gtimg.cn/appstock/app/usfqkline/get"
18
18
 
19
19
  def __init__(self, http_client: HTTPClient = None):
20
20
  """
@@ -56,7 +56,7 @@ class TencentDataSource(DataSource):
56
56
  if not response:
57
57
  raise DataSourceError(f"Failed to fetch from Tencent: {symbol}")
58
58
 
59
- # 解析响应
59
+ # 解析响应,确保响应对象被正确关闭
60
60
  try:
61
61
  text = response.text
62
62
  # 处理不同的响应格式
@@ -83,6 +83,9 @@ class TencentDataSource(DataSource):
83
83
  return data
84
84
  except json.JSONDecodeError as e:
85
85
  raise ParseError(f"Parse error: {e}")
86
+ finally:
87
+ # 确保响应对象被关闭,释放SSL连接
88
+ response.close()
86
89
 
87
90
  def fetch_tick(self, symbols: List[str]) -> Dict[str, Any]:
88
91
  """获取实时行情(暂未实现)"""
@@ -159,7 +159,7 @@ class CNStockMarket(Market):
159
159
  from ..utils import hget
160
160
  import json
161
161
 
162
- url = f'http://web.ifzq.gtimg.cn/appstock/app/newfqkline/get?param={symbol},{freq},{sdate},{edate},{days},{fq}'
162
+ url = f'https://web.ifzq.gtimg.cn/appstock/app/newfqkline/get?param={symbol},{freq},{sdate},{edate},{days},{fq}'
163
163
  response = hget(url)
164
164
  if not response:
165
165
  raise DataSourceError(f'Failed to fetch data for {symbol}')
@@ -91,6 +91,7 @@ class hget:
91
91
  """
92
92
  def __init__(self, url, *args, **kwargs):
93
93
  self.url = url
94
+ r = None
94
95
  try:
95
96
  r = httpx.get(
96
97
  self.url, follow_redirects=True, headers=WebUtils.headers(),
@@ -101,4 +102,8 @@ class hget:
101
102
  logger.error(f'fetch {self.url} err: {e}')
102
103
  self.text = ''
103
104
  self.content = b''
105
+ finally:
106
+ # 确保响应对象被关闭,释放SSL连接
107
+ if r is not None:
108
+ r.close()
104
109
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rquote
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch
5
5
  Requires-Python: >=3.6.1
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ API测试(集成测试)
4
4
  """
5
5
  import unittest
6
6
  from rquote import get_price, get_cn_stock_list, get_all_industries
7
- from rquote.exceptions import SymbolError, DataSourceError
7
+ from rquote.exceptions import SymbolError, DataSourceError, NetworkError
8
8
 
9
9
 
10
10
  class TestAPI(unittest.TestCase):
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