akshare 1.14.65__py3-none-any.whl → 1.14.66__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of akshare might be problematic. Click here for more details.

akshare/__init__.py CHANGED
@@ -2876,9 +2876,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2876
2876
  1.14.63 add: add spot_quotations_sge interface
2877
2877
  1.14.64 fix: fix stock_board_industry_spot_em interface
2878
2878
  1.14.65 fix: fix option_dce_daily interface
2879
+ 1.14.66 fix: fix stock_profit_forecast_ths interface
2879
2880
  """
2880
2881
 
2881
- __version__ = "1.14.65"
2882
+ __version__ = "1.14.66"
2882
2883
  __author__ = "AKFamily"
2883
2884
 
2884
2885
  import sys
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/1/20 23:30
4
+ Date: 2024/8/28 15:20
5
5
  Desc: 世界各大城市生活成本数据
6
6
  https://expatistan.com/cost-of-living/index
7
7
  """
8
+
8
9
  from io import StringIO
9
10
 
10
11
  import pandas as pd
@@ -20,14 +21,14 @@ def _get_region() -> dict:
20
21
  """
21
22
  url = "https://www.expatistan.com/cost-of-living/index"
22
23
  r = requests.get(url)
23
- soup = BeautifulSoup(r.text, "lxml")
24
+ soup = BeautifulSoup(r.text, features="lxml")
24
25
  half_url_list = [
25
26
  item["href"]
26
- for item in soup.find("ul", attrs={"class": "regions"}).find_all("a")
27
+ for item in soup.find(name="ul", attrs={"class": "regions"}).find_all("a")
27
28
  ]
28
29
  name_list = [
29
30
  item["href"].split("/")[-1]
30
- for item in soup.find("ul", attrs={"class": "regions"}).find_all("a")
31
+ for item in soup.find(name="ul", attrs={"class": "regions"}).find_all("a")
31
32
  ]
32
33
  name_url_dict = dict(zip(name_list, half_url_list))
33
34
  name_url_dict["world"] = "/cost-of-living/index"
@@ -38,7 +39,8 @@ def cost_living(symbol: str = "world") -> pd.DataFrame:
38
39
  """
39
40
  国家或地区生活成本数据
40
41
  https://expatistan.com/cost-of-living/index
41
- :param symbol: choice of {"europe", "north-america", "latin-america", "asia", "middle-east", "africa", "oceania", "world"}
42
+ :param symbol: choice of {"europe", "north-america", "latin-america",
43
+ "asia", "middle-east", "africa", "oceania", "world"}
42
44
  :type symbol: str
43
45
  :return: 国家或地区生活成本数据
44
46
  :rtype: pandas.DataFrame
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/8/18 15:29
4
+ Date: 2024/8/28 15:30
5
5
  Desc: 巨潮资讯-数据中心-评级预测-投资评级
6
- http://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7
6
+ https://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7
7
7
  """
8
8
 
9
9
  import pandas as pd
@@ -22,7 +22,7 @@ def _get_file_content_cninfo(file: str = "cninfo.js") -> str:
22
22
  :rtype: str
23
23
  """
24
24
  setting_file_path = get_ths_js(file)
25
- with open(setting_file_path) as f:
25
+ with open(setting_file_path, encoding="utf-8") as f:
26
26
  file_data = f.read()
27
27
  return file_data
28
28
 
@@ -30,7 +30,7 @@ def _get_file_content_cninfo(file: str = "cninfo.js") -> str:
30
30
  def stock_rank_forecast_cninfo(date: str = "20230817") -> pd.DataFrame:
31
31
  """
32
32
  巨潮资讯-数据中心-评级预测-投资评级
33
- http://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7
33
+ https://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7
34
34
  :param date: 查询日期
35
35
  :type date: str
36
36
  :return: 投资评级
@@ -54,7 +54,8 @@ def stock_rank_forecast_cninfo(date: str = "20230817") -> pd.DataFrame:
54
54
  "Pragma": "no-cache",
55
55
  "Proxy-Connection": "keep-alive",
56
56
  "Referer": "http://webapi.cninfo.com.cn/",
57
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36",
57
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
58
+ "Chrome/93.0.4577.63 Safari/537.36",
58
59
  "X-Requested-With": "XMLHttpRequest",
59
60
  }
60
61
  r = requests.post(url, params=params, headers=headers)
@@ -1,13 +1,18 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/4/9 21:44
4
+ Date: 2024/8/28 15:00
5
5
  Desc: 同花顺-盈利预测
6
6
  https://basic.10jqka.com.cn/new/600519/worth.html
7
7
  """
8
+
9
+ from io import StringIO
10
+
8
11
  import pandas as pd
9
12
  import requests
10
13
 
14
+ from akshare.utils.cons import headers
15
+
11
16
 
12
17
  def stock_profit_forecast_ths(
13
18
  symbol: str = "600519", indicator: str = "预测年报每股收益"
@@ -23,21 +28,18 @@ def stock_profit_forecast_ths(
23
28
  :rtype: pandas.DataFrame
24
29
  """
25
30
  url = f"https://basic.10jqka.com.cn/new/{symbol}/worth.html"
26
- headers = {
27
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
28
- }
29
31
  r = requests.get(url, headers=headers)
30
32
  r.encoding = "gbk"
31
33
  if indicator == "预测年报每股收益":
32
- temp_df = pd.read_html(r.text)[0]
34
+ temp_df = pd.read_html(StringIO(r.text))[0]
33
35
  temp_df["年度"] = temp_df["年度"].astype(str)
34
36
  return temp_df
35
37
  if indicator == "预测年报净利润":
36
- temp_df = pd.read_html(r.text)[1]
38
+ temp_df = pd.read_html(StringIO(r.text))[1]
37
39
  temp_df["年度"] = temp_df["年度"].astype(str)
38
40
  return temp_df
39
41
  if indicator == "业绩预测详表-机构":
40
- temp_df = pd.read_html(r.text)[2]
42
+ temp_df = pd.read_html(StringIO(r.text))[2]
41
43
  columns_list = []
42
44
  for item in temp_df.columns:
43
45
  columns_list.append(item[1])
@@ -51,7 +53,7 @@ def stock_profit_forecast_ths(
51
53
  temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
52
54
  return temp_df
53
55
  if indicator == "业绩预测详表-详细指标预测":
54
- temp_df = pd.read_html(r.text)[3]
56
+ temp_df = pd.read_html(StringIO(r.text))[3]
55
57
  temp_df.columns = [
56
58
  item.replace("(", "-").replace(")", "") for item in temp_df.columns
57
59
  ]
@@ -59,6 +61,13 @@ def stock_profit_forecast_ths(
59
61
 
60
62
 
61
63
  if __name__ == "__main__":
62
- for item in ["预测年报每股收益", "预测年报净利润", "业绩预测详表-机构", "业绩预测详表-详细指标预测"]:
63
- stock_profit_forecast_ths_df = stock_profit_forecast_ths(symbol="600519", indicator=item)
64
+ for _item in [
65
+ "预测年报每股收益",
66
+ "预测年报净利润",
67
+ "业绩预测详表-机构",
68
+ "业绩预测详表-详细指标预测",
69
+ ]:
70
+ stock_profit_forecast_ths_df = stock_profit_forecast_ths(
71
+ symbol="600519", indicator=_item
72
+ )
64
73
  print(stock_profit_forecast_ths_df)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.14.65
3
+ Version: 1.14.66
4
4
  Summary: AKShare is an elegant and simple financial data interface library for Python, built for human beings!
5
5
  Home-page: https://github.com/akfamily/akshare
6
6
  Author: AKFamily
@@ -1,4 +1,4 @@
1
- akshare/__init__.py,sha256=-hJ6YdUISPANmHfIPC0x-w1aQoTWDB7BciYS34h0B0M,181098
1
+ akshare/__init__.py,sha256=dEuaO6dYs2XIQvfEjUWWLIaIXrIC8aiPuJMWFnrF3ak,181151
2
2
  akshare/datasets.py,sha256=oIu1zC7o_LMHY22lQmdM7vCnryHibKrJLBqJwQiitlI,1167
3
3
  akshare/air/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
4
4
  akshare/air/air_hebei.py,sha256=xIXNGLK7IGYqrkteM9fxnHAwWqk6PCQs6D9-ggZ7byY,4442
@@ -33,7 +33,7 @@ akshare/bond/bond_zh_cov.py,sha256=yL77itRK0rFCeQP_M524lW1740D5Q1IZW6eLvjXf2H4,2
33
33
  akshare/bond/bond_zh_sina.py,sha256=msj7upgqaCTzC_MxzhUm7hVKtzHeWRUjlcjvZn2zlbw,4654
34
34
  akshare/bond/cons.py,sha256=SGqjMqRYwJlEb8UczxdcrtcD7I2SAVULXARGEedEQfE,1792
35
35
  akshare/cost/__init__.py,sha256=x1R9hH6E0M7C86XhHFzbPiipUWz9IknuhVZrk4gZus4,82
36
- akshare/cost/cost_living.py,sha256=LRJKKthUOfg-pAGwJpp9R8Ad3ve_yb9vSnjABxfJbQc,2054
36
+ akshare/cost/cost_living.py,sha256=_yoGEW4jBfpjhgMxCXvMtBbrCx2PEuOngV3laEoEOvk,2078
37
37
  akshare/crypto/__init__.py,sha256=lbmNMPPLGkW9AgGL4ZnCwoQvPjOFPDNUz6P3arSkNI0,83
38
38
  akshare/crypto/crypto_bitcoin_cme.py,sha256=IO4dxPj-kwtJXo9F_h5tH64__yeDQXs2cavCkgxxp1I,2436
39
39
  akshare/crypto/crypto_hist_investing.py,sha256=tIeEkFur-u-E2_-R4I_Zy0s_VFnR03CCl4GpgJkLYJw,9748
@@ -265,7 +265,7 @@ akshare/stock/stock_ipo_summary_cninfo.py,sha256=Ma-54GsOOhRWxilLH-Qmm0VVbpJQGf2
265
265
  akshare/stock/stock_new_cninfo.py,sha256=EOuZowDLQSSHyPAwXcuPXbQkqhbz2nRBZsM7o2ZWILE,5725
266
266
  akshare/stock/stock_news_cx.py,sha256=IuNo67ToW6SNT9aZVTDqQMnlLFw4QV-_FWSw-9vgfB4,1055
267
267
  akshare/stock/stock_profile_cninfo.py,sha256=tiEPnoH7IGp9DV1kMQNGIXuVOWpQFl_BS_RX_ijM4BI,3163
268
- akshare/stock/stock_rank_forecast.py,sha256=Qh7bwfQ_Dq8bEMuMLOzFOc_da_0n2GKr8tRFeFqTo5g,3168
268
+ akshare/stock/stock_rank_forecast.py,sha256=5U0fa4tzhqKrw5kDRahUCFSrbrEx_aRtlqZq2mpeJaU,3199
269
269
  akshare/stock/stock_repurchase_em.py,sha256=XVAUD_yd48wqxbMbfU0Ne2SNFOSG9NBklUhf3pl6cKc,5000
270
270
  akshare/stock/stock_share_changes_cninfo.py,sha256=zg-1KHPbxdMRMr4wYY8LA30D-u47YesbEDt_MgCMk_k,4846
271
271
  akshare/stock/stock_share_hold.py,sha256=uToDxxnaD9nVtsidq0kVK-LzWU4XZdZBdzJnJvywAfI,10959
@@ -364,7 +364,7 @@ akshare/stock_fundamental/stock_mda_ym.py,sha256=OdWTiZc0HhTOgGtDiIN1A-u2K51eMZa
364
364
  akshare/stock_fundamental/stock_notice.py,sha256=tGxGz1Usr3qQzgs1Y71imDPkqJz5ooismz3BiaBwQR0,3928
365
365
  akshare/stock_fundamental/stock_profit_forecast_em.py,sha256=QP7jgMwto9o1zc1vDl9BBeta_lgxA13NMbijs9eqjRs,5377
366
366
  akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py,sha256=dQaqxi0wXOidIuAxjUzZy_gdy16HEi20I3jEdpNM3qc,5179
367
- akshare/stock_fundamental/stock_profit_forecast_ths.py,sha256=LP3tBRMZEYKA7VE5-wQ7Pj-H5R57oo0sqTmxbMMobq0,2648
367
+ akshare/stock_fundamental/stock_profit_forecast_ths.py,sha256=ZTShEB5w1y5j6TsHzWT8QR8oatbBTdE1H0IIxPLHn9s,2656
368
368
  akshare/stock_fundamental/stock_recommend.py,sha256=44l1uLofwO-nsDB4oAYWpHQA7_qhXLOo1BurjUvmXzY,4501
369
369
  akshare/stock_fundamental/stock_register_em.py,sha256=QxQh7kddjXLainVVugvOCYG8nDyOv31I8npQmXw3Ccs,15643
370
370
  akshare/stock_fundamental/stock_restricted_em.py,sha256=e5G3oiZBf9d_a8quX5nLzn3RggeF4yX3j-h3nAZBRmA,13378
@@ -379,9 +379,9 @@ akshare/utils/func.py,sha256=PDkwpyCjZCbCLSAG9wBQt-sYNtb1XlpUBvhAfuSLf3s,586
379
379
  akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOeQ,666
380
380
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
381
381
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
382
- tests/test_func.py,sha256=tfvy_YnYmDra2dkKZ5JvprU1gNW5X9T634PszdSdH1A,944
383
- akshare-1.14.65.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
- akshare-1.14.65.dist-info/METADATA,sha256=K48tcTg49VogE_x7iNQLPrPf9WO-FK4FAZyWb8XrNrE,13961
385
- akshare-1.14.65.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
386
- akshare-1.14.65.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
- akshare-1.14.65.dist-info/RECORD,,
382
+ tests/test_func.py,sha256=OK--59gYndzZ-t4iAbfoMrERE6MPUV24u1Ja1wlv0BM,946
383
+ akshare-1.14.66.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.14.66.dist-info/METADATA,sha256=bvoryNxW6M_xnsyuCCash2eA2yelVNrdcztN1GsS2Ko,13961
385
+ akshare-1.14.66.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
386
+ akshare-1.14.66.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.14.66.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (73.0.1)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_func.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/3/14 18:00
4
+ Date: 2024/8/28 15:00
5
5
  Desc: To test intention, just write test code here!
6
6
  """
7
7
 
@@ -42,6 +42,6 @@ def test_zipfile_func():
42
42
 
43
43
 
44
44
  if __name__ == "__main__":
45
- test_cost_living()
45
+ # test_cost_living()
46
46
  test_path_func()
47
47
  test_zipfile_func()