Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stock_a_congestion_lg 接口异常 #4785

Closed
wuyulong0931 opened this issue Apr 25, 2024 · 1 comment
Closed

stock_a_congestion_lg 接口异常 #4785

wuyulong0931 opened this issue Apr 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wuyulong0931
Copy link

stock_a_congestion_lg接口异常, 报错如下:
AttributeError Traceback (most recent call last)
Cell In[4], line 5
2 import matplotlib.pyplot as plt
4 # 获取大盘拥挤度数据
----> 5 stock_a_congestion_lg_df = ak.stock_a_congestion_lg()
7 # 绘制折线图
8 fig, ax1 = plt.subplots(figsize=(20, 8))

File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\stock_feature\stock_congestion_lg.py:27, in stock_a_congestion_lg()
22 token = get_token_lg()
23 params = {"token": token}
24 r = requests.get(
25 url,
26 params=params,
---> 27 **get_cookie_csrf(url="https://legulegu.com/stockdata/ashares-congestion")
28 )
29 data_json = r.json()
30 temp_df = pd.DataFrame(data_json["items"])

File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\stock_feature\stock_a_indicator.py:27, in get_cookie_csrf(url)
25 soup = BeautifulSoup(r.text, features="lxml")
26 csrf_tag = soup.find(name="meta", attrs={"name": "_csrf"})
---> 27 csrf_token = csrf_tag.attrs["content"]
28 headers = {"X-CSRF-Token": csrf_token}
29 return {"cookies": r.cookies, "headers": headers}

AttributeError: 'NoneType' object has no attribute 'attrs'

@wuyulong0931 wuyulong0931 added the bug Something isn't working label Apr 25, 2024
@albertandking
Copy link
Collaborator

stock_a_congestion_lg

接口正常

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants