import requests
import pandas as pd
url = 'https://stock.wespai.com/pick/choice'
header = {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'referer': 'https://stock.wespai.com/pick',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36'
}
#股價 5 元至 10 元
myobj = {'qry[]':'dv','id[]':'dv','val[]':'5;10'}
x = requests.post(url, data = myobj,headers=header)
print(x.text)
data = x.json()
print(data)
df = pd.DataFrame.from_dict(data)
df
|