在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python/ python爬蟲post請求失敗

python爬蟲post請求失敗

用python3.6寫的爬蟲,requests庫,post獲取數(shù)據(jù)。
地址:http://epub.sipo.gov.cn/index...
想要獲得的數(shù)據(jù)在:
clipboard.png
例如 2018.05.29 發(fā)明授權數(shù)據(jù)已更新。

clipboard.png
我想要的數(shù)據(jù)在這里。

下面是代碼,代碼是通過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)

返回結果是沒有查詢結果:

clipboard.png

回答
編輯回答
青黛色

用Postman測試通過啦再寫代碼。

2018年3月16日 08:17