bj_0163_bj 2019-12-27 17:20 采纳率: 100%
浏览 505
已结题

还是这个爬虫问题,请指教,可以连上个问答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 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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 MFC平台生成指定圆
  • ¥15 jmeter出现403
  • ¥500 求华为P30PRO手机硬盘数据恢复
  • ¥15 关于#vscode#的问题:ESP32开发板对接MQTT实现小灯泡的开关
  • ¥15 TMC2209串口模式下读取不到寄存器的值串口助手蓝色字体是发过去的消息,绿色字体是收到的消息,第二行发送读取寄存器的指令但是没有读取到寄存器的值串口助手如下图:接线如下图,如何解决?
  • ¥15 高通安卓11提取完整线刷包软件,或者优博讯dt50顺丰刷机包
  • ¥20 C,有个译码器,换了信道就跑不出原来数据
  • ¥15 MIMIC数据库安装问题
  • ¥60 基于JTag协议开发Fpga下载器上位机,哪位大🐂有偿指导?
  • ¥20 全书网Java爬取数据