akshare 1.14.49__py3-none-any.whl → 1.14.50__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.
akshare/__init__.py CHANGED
@@ -2860,9 +2860,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2860
2860
  1.14.47 fix: fix spot_hog_soozhu interface
2861
2861
  1.14.48 add: add spot_hog_year_trend_soozhu interface
2862
2862
  1.14.49 fix: fix fortune_rank interface
2863
+ 1.14.50 add: add spot_hog_lean_price_soozhu interface
2863
2864
  """
2864
2865
 
2865
- __version__ = "1.14.49"
2866
+ __version__ = "1.14.50"
2866
2867
  __author__ = "AKFamily"
2867
2868
 
2868
2869
  import sys
@@ -2887,7 +2888,7 @@ del sys
2887
2888
  """
2888
2889
  搜猪-生猪大数据-各省均价实时排行榜
2889
2890
  """
2890
- from akshare.spot.spot_hog_soozhu import spot_hog_soozhu, spot_hog_year_trend_soozhu
2891
+ from akshare.spot.spot_hog_soozhu import spot_hog_soozhu, spot_hog_year_trend_soozhu, spot_hog_lean_price_soozhu
2891
2892
 
2892
2893
  """
2893
2894
  知名港股
@@ -4885,11 +4886,6 @@ from akshare.fund.fund_amac import (
4885
4886
  amac_person_bond_org_list,
4886
4887
  )
4887
4888
 
4888
- """
4889
- 世界五百强公司排名接口
4890
- """
4891
- from akshare.fortune.fortune_500 import fortune_rank, fortune_rank_eng
4892
-
4893
4889
  """
4894
4890
  申万行业一级
4895
4891
  """
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/3/11 17:22
4
+ Date: 2024/8/4 17:22
5
5
  Desc: 历年世界 500 强榜单数据
6
6
  https://www.fortunechina.com/fortune500/index.htm
7
7
  特殊情况说明:
8
8
  2010年由于网页端没有公布公司所属的国家, 故 2010 年数据没有国家这列
9
9
  """
10
10
 
11
- import json
12
11
  from functools import lru_cache
13
12
  from io import StringIO
14
13
 
@@ -69,42 +68,7 @@ def fortune_rank(year: str = "2015") -> pd.DataFrame:
69
68
  return df
70
69
 
71
70
 
72
- def fortune_rank_eng(year: str = "2023") -> pd.DataFrame:
73
- """
74
- 注意你的网速
75
- https://fortune.com/ranking/global500/
76
- https://fortune.com/global500/2012/search/
77
- :param year: "1995"
78
- :type year: str
79
- :return: 历年排名
80
- :rtype: pandas.DataFrame
81
- """
82
- url = f"https://fortune.com/ranking/global500/{year}/search/"
83
- r = requests.get(url)
84
- soup = BeautifulSoup(r.text, features="lxml")
85
- code = json.loads(
86
- soup.find(name="script", attrs={"type": "application/ld+json"}).string
87
- )["identifier"]
88
- url = "https://content.fortune.com/wp-json/irving/v1/data/franchise-search-results"
89
- params = {
90
- "list_id": code,
91
- "token": "Zm9ydHVuZTpCcHNyZmtNZCN5SndjWkkhNHFqMndEOTM=",
92
- }
93
- r = requests.get(url, params=params)
94
- big_df = pd.DataFrame()
95
- for i in range(len(r.json()[1]["items"][0]["fields"])):
96
- temp_df = pd.DataFrame([item["fields"][i] for item in r.json()[1]["items"]])
97
- big_df[temp_df["key"].values[0]] = temp_df["value"]
98
- big_df["rank"] = big_df["rank"].astype(int)
99
- big_df.sort_values(by="rank", inplace=True)
100
- big_df.reset_index(drop=True, inplace=True)
101
- return big_df
102
-
103
-
104
71
  if __name__ == "__main__":
105
- fortune_rank_eng_df = fortune_rank_eng(year="2022")
106
- print(fortune_rank_eng_df)
107
-
108
72
  fortune_rank_df = fortune_rank(year="2023") # 2010 不一样
109
73
  print(fortune_rank_df)
110
74
 
@@ -62,9 +62,36 @@ def spot_hog_year_trend_soozhu() -> pd.DataFrame:
62
62
  return temp_df
63
63
 
64
64
 
65
+ def spot_hog_lean_price_soozhu() -> pd.DataFrame:
66
+ """
67
+ 搜猪-生猪大数据-全国瘦肉型肉猪
68
+ https://www.soozhu.com/price/data/center/
69
+ :return: 全国瘦肉型肉猪
70
+ :rtype: pd.DataFrame
71
+ """
72
+ session = requests.session()
73
+ url = "https://www.soozhu.com/price/data/center/"
74
+ r = session.get(url)
75
+ soup = BeautifulSoup(r.text, features="lxml")
76
+ token = soup.find(name="input", attrs={"name": "csrfmiddlewaretoken"})["value"]
77
+ url = "https://www.soozhu.com/price/data/center/"
78
+ payload = {"act": "pricetrend", "indid": "", "csrfmiddlewaretoken": token}
79
+ r = session.post(url, data=payload)
80
+ data_json = r.json()
81
+ temp_df = pd.DataFrame(data_json["datalist"])
82
+ temp_df.columns = ["日期", "价格"]
83
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
84
+ temp_df["价格"] = pd.to_numeric(temp_df["价格"], errors="coerce")
85
+ temp_df.sort_values(by=["日期"], ignore_index=True, inplace=True)
86
+ return temp_df
87
+
88
+
65
89
  if __name__ == "__main__":
66
90
  spot_hog_soozhu_df = spot_hog_soozhu()
67
91
  print(spot_hog_soozhu_df)
68
92
 
69
93
  spot_hog_year_trend_soozhu_df = spot_hog_year_trend_soozhu()
70
94
  print(spot_hog_year_trend_soozhu_df)
95
+
96
+ spot_hog_lean_price_soozhu_df = spot_hog_lean_price_soozhu()
97
+ print(spot_hog_lean_price_soozhu_df)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.14.49
3
+ Version: 1.14.50
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=pEmZLvGV4WCO1j-1Zxi6NeOAG2U-z5g8Rxbq2oxaRv4,180229
1
+ akshare/__init__.py,sha256=EB-XN3cFOWPfD8DVjryY_6O60QLAzi3zjUMBIBLYZx0,180197
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
@@ -75,7 +75,7 @@ akshare/event/migration.py,sha256=2lR3D_XHRlOKiarBSbjQVEIm3Spj5hbZIwDOvcyKsEU,37
75
75
  akshare/file_fold/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
76
76
  akshare/file_fold/calendar.json,sha256=gKqhd5CrXPGbhfztADaT6WjDDGrxGoxIOKGjB1VUsLk,116370
77
77
  akshare/fortune/__init__.py,sha256=4OCuVKMykUB3Ubm8WogA814U5EGLdrexmfTAOcBnYM4,82
78
- akshare/fortune/fortune_500.py,sha256=V3d3KDHn89j3CItVtSDtDvj1RbHX-OJ4rYRhFTMT0kI,4485
78
+ akshare/fortune/fortune_500.py,sha256=QqF3dLdDiCcSoDxsyEgJf8CHu72Ppsu7u0EajbXr6mg,3197
79
79
  akshare/fortune/fortune_bloomberg.py,sha256=i5HqnICYXKmwy3rOvMLDzJPDJA_am8imKsXzNlLLU6g,3673
80
80
  akshare/fortune/fortune_forbes_500.py,sha256=GiHFZ_dLHkc3K03H1rfVQ0FEGbwOWjdF4CFlRXXWBIM,1437
81
81
  akshare/fortune/fortune_hurun.py,sha256=B2BMDdwsatY5Yo2hX03GBqMJyifPhQzsRTXhelVNs6s,11512
@@ -227,7 +227,7 @@ akshare/reits/reits_basic.py,sha256=gxQeP8_K7SYjBT9zkKuVRRi8B4SPOHNqVdXe_UvTWTY,
227
227
  akshare/sport/__init__.py,sha256=aMsxmuOMZFkcI8tGmQanhPyPwyBpdeApAWyCtDRKMeg,81
228
228
  akshare/sport/sport_olympic.py,sha256=CB1cvLpz2BWuadfonhHuQ17Qxt9X_3ks0Zc5Bff2w9k,818
229
229
  akshare/spot/__init__.py,sha256=VGuha94pXYoezmMs3F3Q_ofaN8RZIrkJ2NtVv8hWCjY,83
230
- akshare/spot/spot_hog_soozhu.py,sha256=4l040e30BIaqheivlQv-0H6AqR1zwvN5JKYYrZxfqlk,2641
230
+ akshare/spot/spot_hog_soozhu.py,sha256=5Lo7AUgUP8CvdeDJCmSVpsiRbSpON6jtm61aKmQeS78,3756
231
231
  akshare/spot/spot_price_qh.py,sha256=rRv09vR8K0U_x6x8AiLgGluxytIXkLatFNVkFbIh8eQ,3756
232
232
  akshare/spot/spot_sge.py,sha256=Ta5EHUlGCSpNDlufIJcwgCErsJEUgH6HJHzYxoYtaMk,6313
233
233
  akshare/stock/__init__.py,sha256=jSa9260d6aNZajaW68chI2mpPkDSXLOgi3eXrqo4MQ8,82
@@ -380,8 +380,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
380
380
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
381
381
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
382
382
  tests/test_func.py,sha256=tfvy_YnYmDra2dkKZ5JvprU1gNW5X9T634PszdSdH1A,944
383
- akshare-1.14.49.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
- akshare-1.14.49.dist-info/METADATA,sha256=XEyUrgLciEc2YOB6U9tmiaD1US6deNhqAPO26RWL3aI,13976
385
- akshare-1.14.49.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
386
- akshare-1.14.49.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
- akshare-1.14.49.dist-info/RECORD,,
383
+ akshare-1.14.50.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.14.50.dist-info/METADATA,sha256=W29RB_CxJjxSY2s8iFrlmq1A2G7eiXhJqW95mopNt7U,13976
385
+ akshare-1.14.50.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
386
+ akshare-1.14.50.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.14.50.dist-info/RECORD,,