在前人基础上进一步修改,话不多说,直接上代码,直接可用!!!
PS:输入为股票代码,如600000
# -*- coding = utf-8 -*-
# @time:2020/9/2 11:34
# Author:Chan
# @Software:PyCharm
import json
import requests
import re
import os
import random
import time
import datetime
try:
os.mkdir('./output')
except:
pass
headers = {
'Connection': 'keep-alive',
'Accept': 'application/json, text/javascript, */*; q=0.01',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'Referer': 'http://www.sse.com.cn/disclosure/listedinfo/announcement/',
'Accept-Language': 'zh-CN,zh;q=0.9',
}
Type='QUATER2' #获取的财报类型:QUATER1 QUATER2 QUATER3 YEARLY
begin = datetime.date(2020,8,1)
end = datetime.date(2020,9