From https://www.cnblogs.com/lsz3034/p/12712395.html
-
import json
-
import time,datetime
-
import os
-
import requests
-
import re
-
-
session = requests.Session()
-
session.headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
-
s1=session.get('')
-
a1=re.search("token=.*?&cmd",s1.text,flags=0)
-
token=a1.group(0).replace("token=","").replace("&cmd","")
-
time.sleep(0.1)
-
h1="{0}&cmd=&st=STARTDATE&sr=-1&p=1&ps={1}&rt=52898794".format(token,"200")
-
s2=session.get(h1)
-
a2=re.search("\[.*?\]",s2.text,flags=0)
-
ar1=json.loads(a2.group(0))
-
ar2=[]
-
for q in ar1:
-
arr1={"BONDCODE":q["BONDCODE"],"SNAME":q["SNAME"],"STARTDATE":q["STARTDATE"],"CORRESCODE":q["CORRESCODE"],"CORRESNAME":q["CORRESNAME"],"SWAPSCODE":q["SWAPSCODE"],"SECURITYSHORTNAME":q["SECURITYSHORTNAME"],"GDYX_STARTDATE":q["GDYX_STARTDATE"]}
-
ar2.append(arr1)
-
-
-
print(len(ar2))
阅读(950) | 评论(0) | 转发(0) |