weixin_42678268
bj_0163_bj
2019-12-27 17:20
采纳率: 50%
浏览 465

还是这个爬虫问题,请指教,可以连上个问答c币一起拿走

http://epub.sipo.gov.cn/flzt.jsp

条件随便选一下。填一个公告日2019网页内容,我直接用post 加这个表单,怎么请求的网页状态是202?
怎么能把这个页面打印出来呢?求大神指教

希望有成功的代码提供,可以再追加C币

图片说明

import requests

url='http://epub.sipo.gov.cn/overTran.action'

headers={
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'Content-Length': '183',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': 'wIlwQR28aVgb80S=Lvo.g17PODuZgSBwRw5l_DbhAy2KLizhec2.qPccW7ZlsQGwXuZw4Wb5hOVq5oi8; WEB=20111132; JSESSIONID=FBCDD5153E797C518ED843E3AD1FB331; _gscu_884396235=77173060h9kwt732; _gscbrs_884396235=1; Hm_lvt_06635991e58cd892f536626ef17b3348=1577173065; Hm_lpvt_06635991e58cd892f536626ef17b3348=1577173065; _gscu_7281245=77173064qyzfmc15; _gscbrs_7281245=1; _gscs_7281245=7717306451fjlb15|pv:1; _gscs_884396235=77173060bpjon232|pv:3; wIlwQR28aVgb80T=4uHABazj.0t59Nq6rlCEGno19R_ZV0hQRyKhvNWAOrF48jAvrmpf9HW3lAO8BJGZ6XYZMEPfNUEiGv5qukwGzGvYHOBbXhvfIm6uWdcfupBcuyrmb0lubppaA2QciDK7GQHlwFO2OA8CPAjjVMNlb9vNguNiRhq2MfQC7FkGZT9CkU_yFz8uODRSS5Nr6rgQFGILh073HC18orKQQdnNdpkG7xipEjE1wz_VJb9FNRE6gwtG8ShAIz5sVNWQKSpK6cdrIUAbRWQGZZ84rE_JUFpnly61EJK2KE0duzqw7vQFTAH.jS6_Sx.oqxYhJnvnjPG9T86if_4Becmw.UgqaANEb',
'Host': 'epub.sipo.gov.cn',
'Origin': 'http://epub.sipo.gov.cn',
'Referer': 'http://epub.sipo.gov.cn/flzt.jsp',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
}

data={'strWord': '法律状态公告日="2019"',
'numType': 18,
'numSortMethod': 4,
'strLicenseCode':'',
'selected':'',
'numFM': 0,
'numXX': 0,
'numWG': 0,
'pageSize': 10,
'pageNow': 1}

rep=requests.post(url,json=data,headers=headers)

  • 点赞
  • 收藏

1条回答 默认 最新

  • dabocaiqq
    dabocaiqq 2019-12-28 00:18
    已采纳
    import requests
    url='http://epub.sipo.gov.cn/overTran.action'
    headers={
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
    'Accept-Encoding': 'gzip, deflate',
    'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
    'Cache-Control': 'max-age=0',
    'Connection': 'keep-alive',
    'Content-Length': '183',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Cookie': 'wIlwQR28aVgb80S=Lvo.g17PODuZgSBwRw5l_DbhAy2KLizhec2.qPccW7ZlsQGwXuZw4Wb5hOVq5oi8; WEB=20111132; JSESSIONID=FBCDD5153E797C518ED843E3AD1FB331; _gscu_884396235=77173060h9kwt732; _gscbrs_884396235=1; Hm_lvt_06635991e58cd892f536626ef17b3348=1577173065; Hm_lpvt_06635991e58cd892f536626ef17b3348=1577173065; _gscu_7281245=77173064qyzfmc15; _gscbrs_7281245=1; _gscs_7281245=7717306451fjlb15|pv:1; _gscs_884396235=77173060bpjon232|pv:3; wIlwQR28aVgb80T=4uHABazj.0t59Nq6rlCEGno19R_ZV0hQRyKhvNWAOrF48jAvrmpf9HW3lAO8BJGZ6XYZMEPfNUEiGv5qukwGzGvYHOBbXhvfIm6uWdcfupBcuyrmb0lubppaA2QciDK7GQHlwFO2OA8CPAjjVMNlb9vNguNiRhq2MfQC7FkGZT9CkU_yFz8uODRSS5Nr6rgQFGILh073HC18orKQQdnNdpkG7xipEjE1wz_VJb9FNRE6gwtG8ShAIz5sVNWQKSpK6cdrIUAbRWQGZZ84rE_JUFpnly61EJK2KE0duzqw7vQFTAH.jS6_Sx.oqxYhJnvnjPG9T86if_4Becmw.UgqaANEb',
    'Host': 'epub.sipo.gov.cn',
    'Origin': 'http://epub.sipo.gov.cn',
    'Referer': 'http://epub.sipo.gov.cn/flzt.jsp',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
    }
    data={'strWord': '法律状态公告日="2019"',
    'numType': 18,
    'numSortMethod': 4,
    'strLicenseCode':'',
    'selected':'',
    'numFM': 0,
    'numXX': 0,
    'numWG': 0,
    'pageSize': 10,
    'pageNow': 1}
    rep=requests.post(url,json=data,headers=headers)
    print(rep.headers)
    print(rep.text)
    输出下头,看看是否挑砖和ajax
    
    点赞 评论

相关推荐