python爬虫post请求失败
用python3.6写的爬虫,requests库,post获取数据。
地址:http://epub.sipo.gov.cn/index...
想要获得的数据在:
例如 2018.05.29 发明授权数据已更新。
我想要的数据在这里。
下面是代码,代码是通过curl to python直接生成的,https://curl.trillworks.com/。
import requests
cookies = {
'_gscu_1718069323': '17199139j8xock20',
'_gscu_2029180466': '223759791wmvjx10',
'yunsuo_session_verify': '3e812c4367705399100bb98f9e16b577',
'_gscu_7281245': '2237647502dqei93',
'_gscbrs_1718069323': '1',
'_va_ref': '%5B%22%22%2C%22%22%2C1529994977%2C%22https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DYaZu8t1kmMcsPYzfoQs86UdJDoO2kofb1oFU3viiKsCJIZ9yL_m1n0AQxswq9DvavpQ4EjzqFXLs94pAhFN_c_%26wd%3D%26eqid%3Dfb76c07900017f6f000000035b31dec2%22%5D',
'_va_id': '516b758a68708fa6.1522634492.10.1529994977.1529994977.',
'JSESSIONID': 'B2D82513C17C3136F8F3CDD4E789B31D',
'WEB': '20111130',
'Hm_lvt_06635991e58cd892f536626ef17b3348': '1528852861,1528852902,1528853005,1530495309',
'_gscbrs_7281245': '1',
'TY_SESSION_ID': 'fb5e77db-26bb-4657-84b0-412460f717e9',
'Hm_lpvt_06635991e58cd892f536626ef17b3348': '1530498299',
'_gscs_7281245': '3049530864pnz237|pv:22',
'keycookie': '4d8222a825',
'expirecookie': '1530498797',
}
headers = {
'Connection': 'keep-alive',
'Cache-Control': 'max-age=0',
'Origin': 'http://epub.sipo.gov.cn',
'Upgrade-Insecure-Requests': '1',
'Content-Type': 'text/plain;charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36',
'Accept': 'image/webp,image/apng,image/*,*/*;q=0.8',
'Referer': 'http://epub.sipo.gov.cn/patentoutline.action',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Intervention': '<https://www.chromestatus.com/feature/5718547946799104>; level="warning"',
}
data = [
('showType', '1'),
('strSources', ''),
('strWhere', 'PD=\'2018.06.26\''),
('numSortMethod', '5'),
('strLicenseCode', ''),
('numIp', '0'),
('numIpc', ''),
('numIg', ''),
('numIgc', ''),
('numIgd', ''),
('numUg', ''),
('numUgc', ''),
('numUgd', ''),
('numDg', ''),
('numDgc', ''),
('pageSize', '3'),
('pageNow', '1'),
]
response = requests.post('http://epub.sipo.gov.cn/patentoutline.action', headers=headers, cookies=cookies, data=data)
返回结果是没有查询结果:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用Postman测试通过啦再写代码。