python请求:参数不改变响应

9rbhqvlz  于 2021-09-08  发布在  Java
关注(0)|答案(0)|浏览(284)

我正在尝试清理此网站:https://case.occ.ok.gov/ords/f?p=1004:203
此代码适用于:

cookies = {
    'ORA_WWV_APP_1004': 'ORA_WWV-EgAZS5mpL04h9fkLznjOOOJe',
    'X-Oracle-BMC-LBS-Route': '99470d8108cf280a5a4294ab4cc5dc838cbed3af',
}

headers = {
    'Connection': 'keep-alive',
    'sec-ch-ua': '^\\^',
    'sec-ch-ua-mobile': '?0',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
    'Accept': 'application/json, text/javascript, */*; q=0.01',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-User': '?1',
    'Sec-Fetch-Dest': 'empty',
    'Referer': '',
    'Accept-Language': 'en-US,en;q=0.9',
    'X-Requested-With': 'XMLHttpRequest',
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
    'Origin': 'https://case.occ.ok.gov',
}

params = (
    ('p', '1004:203:12872751052351::NO:::'),
)

data = {
  'p_flow_id': '1004',
  'p_flow_step_id': '203',
  'p_instance': '12872751052351',
  'p_debug': '',
  'p_request': 'Search',
  'p_reload_on_submit': 'S',
  'p_page_submission_id': '338487700446642322664804148876160471590',
  'p_json': '{"pageItems":{"itemsToSubmit":[{"n":"P203_LASTNAME","v":"A"},{"n":"P203_FIRSTNAME","v":""},{"n":"P203_SEARCH_CRITERIA","v":"1"}],"protected":"eRNBl4fMu8zfXirH1yQg6A","rowVersion":"","formRegionChecksums":[]},"salt":"338487700446642322664804148876160471590"}'
}

r = requests.post('https://case.occ.ok.gov/ords/f', headers=headers, params=params, cookies=cookies, data=data)

但当我试图更改数据时:

data = {
  'p_flow_id': '1004',
  'p_flow_step_id': '203',
  'p_instance': '12872751052351',
  'p_debug': '',
  'p_request': 'Search',
  'p_reload_on_submit': 'S',
  'p_page_submission_id': '338487700446642322664804148876160471590',
  'p_json': '{"pageItems":{"itemsToSubmit":[{"n":"P203_LASTNAME","v":"B"},{"n":"P203_FIRSTNAME","v":""},{"n":"P203_SEARCH_CRITERIA","v":"1"}],"protected":"eRNBl4fMu8zfXirH1yQg6A","rowVersion":"","formRegionChecksums":[]},"salt":"338487700446642322664804148876160471590"}'
}

要搜索不同的字母“b”,响应与第一次相同。
事实上,我可以从请求中完全删除“data”和“headers”参数,但仍然得到相同的响应:

r = requests.post('https://case.occ.ok.gov/ords/f', params=params, cookies=cookies)

那么我在这里错过了什么?看起来它需要的是params参数,据我所知,它只在1004:203之后的长数字字符串中变化:

params = (
    ('p', '1004:203:12872751052351::NO:::'),
)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题