POST请求有问题 - 无效请求

时间:2016-08-11 14:26:54

标签: python post python-requests

我正在尝试复制请求。我有一个会话并正常运行,直到最后一次POST。

在浏览器中:

General:
Request URL:https:// paycom online. net/v4/e e/ee-taweb sheet.php
Request Method:POST
Status Code:302 Moved Temporarily

Headers:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:483
Content-Type:application/x-www-form-urlencoded
Host:www.paycomonline.net
Origin:https://www.paycomonline.net
Referer:https://www.paycom online. net/v4/e e/ee-taweb sheet.php?periodsel.....
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36


Form Data:
session_nonce:f14fd8003d9014259f6e5298f64
newpunchdatestr:08/10/2016
newpunchdateend:00/00/0000
daysFromTodayStart:-4
daysFromTodayEnd:10
periodstr:08/06/2016
periodend:08/20/2016
newpunchdept:
jobcategory[1]:
jobcategory[2]:
newpunchtype:OD
PunchTime:06:53 PM
date_time_format:hh:mm p
newpunchdesc:
newpunchtaxprof:0
periodselect:2016-08-06_2016-08-19
approvalday:2016-08-06
clockid:WEB01
cmdaddpunch:1
session_nonce:f14fd8003d9014259f6e5298f64

在请求中,我有以下内容:

headers={
    'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Encoding':'gzip, deflate, br',
    'Accept-Language':'en-US,en;q=0.8',
    'Cache-Control':'max-age=0',
    'Upgrade-Insecure-Requests':'1',
    'User-Agent':'Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36'
}


data={
    'session_nonce':session_nonce,
    'newpunchdatestr':'08/10/2016',
    'newpunchdateend':'00/00/0000',
    'daysFromTodayStart':'-4',
    'daysFromTodayEnd':'10',  
    'periodstr':'08/06/2016',
    'periodend':'08/20/2016',
    'newpunchdept':'',
    'jobcategory[1]':'',
    'jobcategory[2]':'',
    'newpunchtype':'OD',
    'PunchTime':'06:53 PM',
    'date_time_format':'hh:mm p',
    'newpunchdesc':'',
    'newpunchtaxprof':'0',
    'periodselect':'2016-08-06_2016-08-19',
    'approvalday':'2016-08-06',
    'clockid':'WEB01',
    'cmdaddpunch':'1'
 }
 r=session.post('https:// paycom online. net/v4/e e/ee-taweb sheet.php', data=data,headers=headers, allow_redirects=False)

我注意到会话现时是一个多键,并尝试将该值设置为包含相同nonce的列表两次,与浏览器内请求中的值相同。我得到200响应,但它到达一个页面,表明先前的请求无效。响应中的标题:

 {'Date': 'Wed, 10 Aug 2016 22:24:37 GMT', 'Content-Length': '152141', 'Server': 'Microsoft-IIS/7.5', 'Content-Type': 'text/html', 'X-Powered-By': 'ASP.NET'}

我做错了什么?谢谢

0 个答案:

没有答案