akshare 1.14.45__py3-none-any.whl → 1.14.47__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
@@ -2856,9 +2856,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2856
2856
  1.14.43 fix: fix stock_share_change_cninfo interface
2857
2857
  1.14.44 fix: fix stock_hk_famous_spot_em interface
2858
2858
  1.14.45 fix: fix option_lhb_em interface
2859
+ 1.14.46 add: add spot_hog_soozhu interface
2860
+ 1.14.47 fix: fix spot_hog_soozhu interface
2859
2861
  """
2860
2862
 
2861
- __version__ = "1.14.45"
2863
+ __version__ = "1.14.47"
2862
2864
  __author__ = "AKFamily"
2863
2865
 
2864
2866
  import sys
@@ -2880,6 +2882,11 @@ if sys.version_info < (3, 9):
2880
2882
 
2881
2883
  del sys
2882
2884
 
2885
+ """
2886
+ 搜猪-生猪大数据-各省均价实时排行榜
2887
+ """
2888
+ from akshare.spot.spot_hog_soozhu import spot_hog_soozhu
2889
+
2883
2890
  """
2884
2891
  知名港股
2885
2892
  """
@@ -0,0 +1,43 @@
1
+ # -*- coding:utf-8 -*-
2
+ # !/usr/bin/env python
3
+ """
4
+ Date: 2024/7/31 16:30
5
+ Desc: 搜猪-生猪大数据-各省均价实时排行榜
6
+ https://www.soozhu.com/price/data/center/
7
+ """
8
+
9
+ import pandas as pd
10
+ import requests
11
+ from bs4 import BeautifulSoup
12
+
13
+
14
+ def spot_hog_soozhu() -> pd.DataFrame:
15
+ """
16
+ 搜猪-生猪大数据-各省均价实时排行榜
17
+ https://www.soozhu.com/price/data/center/
18
+ :return: 各省均价实时排行榜
19
+ :rtype: pd.DataFrame
20
+ """
21
+ session = requests.session()
22
+ url = "https://www.soozhu.com/price/data/center/"
23
+ r = session.get(url)
24
+ soup = BeautifulSoup(r.text, features="lxml")
25
+ token = soup.find(name="input", attrs={"name": "csrfmiddlewaretoken"})["value"]
26
+ url = "https://www.soozhu.com/price/data/center/"
27
+ payload = {"act": "mapdata", "csrfmiddlewaretoken": token}
28
+ r = session.post(url, data=payload)
29
+ data_json = r.json()
30
+ temp_df = pd.DataFrame(data_json["vlist"])
31
+ price_list = [item[0] for item in temp_df["value"]]
32
+ pct_list = [item[1] for item in temp_df["value"]]
33
+ big_df = pd.DataFrame([temp_df["name"].values, price_list, pct_list]).T
34
+ big_df.columns = ["省份", "价格", "涨跌幅"]
35
+ big_df["价格"] = pd.to_numeric(big_df["价格"], errors="coerce")
36
+ big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
37
+ big_df["涨跌幅"] = round(big_df["涨跌幅"], 2)
38
+ return big_df
39
+
40
+
41
+ if __name__ == "__main__":
42
+ spot_hog_soozhu_df = spot_hog_soozhu()
43
+ print(spot_hog_soozhu_df)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.14.45
3
+ Version: 1.14.47
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=DtCCpn7g7OsBpdtGllo_xkvDfDqDQajNcTA52L55f7c,180011
1
+ akshare/__init__.py,sha256=VZTkZinnFxazlt-Pet9pEhTfVsS4bAuDnf6P9NiF4wA,180214
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
@@ -228,6 +228,7 @@ akshare/sport/__init__.py,sha256=aMsxmuOMZFkcI8tGmQanhPyPwyBpdeApAWyCtDRKMeg,81
228
228
  akshare/sport/sport_olympic.py,sha256=CB1cvLpz2BWuadfonhHuQ17Qxt9X_3ks0Zc5Bff2w9k,818
229
229
  akshare/sport/sport_olympic_winter.py,sha256=l_NhDpYfUBJMCLDezIa8un1S5Z_R6giv8EsuTRXgt6E,1473
230
230
  akshare/spot/__init__.py,sha256=VGuha94pXYoezmMs3F3Q_ofaN8RZIrkJ2NtVv8hWCjY,83
231
+ akshare/spot/spot_hog_soozhu.py,sha256=S42cfeR76cl2x9lKbQdIH9sawaqToXtIdJnr6kW5zZA,1508
231
232
  akshare/spot/spot_price_qh.py,sha256=rRv09vR8K0U_x6x8AiLgGluxytIXkLatFNVkFbIh8eQ,3756
232
233
  akshare/spot/spot_sge.py,sha256=Ta5EHUlGCSpNDlufIJcwgCErsJEUgH6HJHzYxoYtaMk,6313
233
234
  akshare/stock/__init__.py,sha256=jSa9260d6aNZajaW68chI2mpPkDSXLOgi3eXrqo4MQ8,82
@@ -380,8 +381,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
380
381
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
381
382
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
382
383
  tests/test_func.py,sha256=tfvy_YnYmDra2dkKZ5JvprU1gNW5X9T634PszdSdH1A,944
383
- akshare-1.14.45.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
- akshare-1.14.45.dist-info/METADATA,sha256=bYKgJn3zZrvoeWkvWXuEcvnU-e3rtRWjCXb_v-FCSog,13976
385
- akshare-1.14.45.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
386
- akshare-1.14.45.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
- akshare-1.14.45.dist-info/RECORD,,
384
+ akshare-1.14.47.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
385
+ akshare-1.14.47.dist-info/METADATA,sha256=pbqC023BkL1kqUqJZZkVrGsZfpo4CXuw-xGh__HGc1U,13976
386
+ akshare-1.14.47.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
387
+ akshare-1.14.47.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
388
+ akshare-1.14.47.dist-info/RECORD,,