使用BeautifulSoup进行解析,但什么也得不到

2024-09-30 08:28:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用一个选择列表来获取web数据,如图中所示。 enter image description herehttps://goodinfo.tw/StockInfo/ShowK_Chart.asp?STOCK_ID=3044&CHT_CAT2=DATE 我观察到,选择后会触发与post方法的链接。 我使用下面的代码获取数据,但没有返回任何内容

import requests
from bs4 import BeautifulSoup
[enter image description here][2]
Query_Para = {
'STOCK_ID': '3044',
'CHT_CAT2': 'DATE',
'STEP': 'DATA',
'PERIOD': '180'}

headers = {
        'User-Agent': 'My User Agent99', 
        'From': 'youremail91@domain.com'
    }

res = requests.post('https://goodinfo.tw/StockInfo/ShowK_Chart.asp', data = Query_Para, headers = headers)

res.encoding = 'utf-8'
soup = BeautifulSoup(res.text, "lxml")

是网络问题还是我的代码? 要得到数据吗

请帮忙。 非常感谢


Tags: 数据httpsimageherestockchartresdescription

热门问题