从网站提取数据表



我想从网站提取数据表。PANDAS READ_HTML给出HTTP错误403。是否还有其他模块可以通过Python提取数据。

这是网站:https://pakstockexchange.com/stock2/index_new.php?section = research& page = show_price_price_table_new&symbol=abot; symbol=abot

掩盖您的会话,就像在使用浏览器:

import requests
header = {
  "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36",
  "X-Requested-With": "XMLHttpRequest"
}
r = requests.get(url, headers=header)
dfs = pd.read_html(r.text)

最新更新