|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import requests
import json
headers={'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'}
url = 'http://scxk.nmpa.gov.cn:81/xk/'
for page in range(1,6):
page=str(page)
data={ 'on': 'true',
'page': page,
'pageSize': '15',
'productName':'',
'conditionType': '1',
'applyname':'',
'applysn': '',}
id_list=[]
json_id=requests.post(url=url, headers=headers, data=data).json()
for dic in json_id['list']:
id_list.append(dic['ID'])
posturl='http://scxk.nmpa.gov.cn:81/xk/itownet/portalAction.do?method=getXkzsById'
for id in id_list:
data={'id':id}
detaildata=requests.post(url=posturl,headers=headers,data=data).text
with open('./html','w',encoding='utf-8')as fp:
fp.write(detaildata)
print('over!')
|
|