akshare 1.14.45__py3-none-any.whl → 1.14.46__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,10 @@ 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
2859
2860
  """
2860
2861
 
2861
- __version__ = "1.14.45"
2862
+ __version__ = "1.14.46"
2862
2863
  __author__ = "AKFamily"
2863
2864
 
2864
2865
  import sys
@@ -2880,6 +2881,11 @@ if sys.version_info < (3, 9):
2880
2881
 
2881
2882
  del sys
2882
2883
 
2884
+ """
2885
+ 搜猪-生猪大数据-各省均价实时排行榜
2886
+ """
2887
+ from akshare.spot.spot_hog_soozhu import spot_hog_soozhu
2888
+
2883
2889
  """
2884
2890
  知名港股
2885
2891
  """
@@ -0,0 +1,42 @@
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
+ r = session.get("https://www.soozhu.com/price/data/center/")
23
+ soup = BeautifulSoup(r.text, features="lxml")
24
+ token = soup.find(name="input", attrs={"name": "csrfmiddlewaretoken"})["value"]
25
+ url = "https://www.soozhu.com/price/data/center/"
26
+ payload = {"act": "mapdata", "csrfmiddlewaretoken": token}
27
+ r = session.post(url, data=payload)
28
+ data_json = r.json()
29
+ temp_df = pd.DataFrame(data_json["vlist"])
30
+ price_list = [item[0] for item in temp_df["value"]]
31
+ pct_list = [item[1] for item in temp_df["value"]]
32
+ big_df = pd.DataFrame([temp_df["name"].values, price_list, pct_list]).T
33
+ big_df.columns = ["省份", "价格", "涨跌幅"]
34
+ big_df["价格"] = pd.to_numeric(big_df["价格"], errors="coerce")
35
+ big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
36
+ big_df["涨跌幅"] = round(big_df["涨跌幅"], 2)
37
+ return big_df
38
+
39
+
40
+ if __name__ == "__main__":
41
+ spot_hog_soozhu_df = spot_hog_soozhu()
42
+ 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.46
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=3XF_Txcce4WrzrTzQs7QyyV49HEa9hhtDmmX9KcN7jQ,180171
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=p34Dr-OhNbn7h786o3n7mQqVzGeO_Jl6kqpiVn0r_l4,1494
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.46.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
385
+ akshare-1.14.46.dist-info/METADATA,sha256=FZHjHRgjuaX6Fc7M0drL5RYLN99jAgTN_Jgd-bfg-Y4,13976
386
+ akshare-1.14.46.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
387
+ akshare-1.14.46.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
388
+ akshare-1.14.46.dist-info/RECORD,,