import pandas as pd
from dg_tools.logic import *
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
'mcode': getMcode(),
'Origin': 'http://webapi.cninfo.com.cn',
'Referer': 'http://webapi.cninfo.com.cn/',
'Cookie': 'routeId=.uc1; Hm_lvt_489bd07e99fbfc5f12cbb4145adb0a9b=1676424165,1676518439; Hm_lpvt_489bd07e99fbfc5f12cbb4145adb0a9b=1676520067; JSESSIONID=3E66FB39A566F84A73524C4A525B8A66'
}
url = 'http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1119?rdate=20221231&market='
response = requests.post(url, headers=headers).json()['records']
df = pd.DataFrame([[i['SECNAME'], i['SECCODE'], i['F002D'], i['F003D'], i['F004D'],i['F005D'], i['F006D']] for i in response],
columns=['SECNAME', 'SECCODE', 'F002D', 'F003D', 'F004D', 'F005D','F006D'])
df = df[df['F006D'].notna()]
print(df)
网友评论