Python请求POST不发布

时间:2018-07-03 17:36:12

标签: python post python-requests

我当前使用POST登录到站点,然后使用POST访问数据表。当我向访问所需数据表的POST中添加表单数据有效载荷(以更改表的排序方式)时,返回的html用于未排序的表。

referrer = "https://edx.standardandpoors.com/mailbox/jsp/MBIList.jsp"

with requests.Session() as s:
    p = s.post(spURL_post, data=spPayload, proxies=proxyDict, verify = True)
    q= s.post(referrer, data=dataSort, proxies = proxyDict, verify = True)
    dataPageResponse = s.get(referrer, proxies = proxyDict, verify = True)

html = BeautifulSoup(dataPageResponse.content,"lxml")

p:我登录了, q:我访问下一页的数据表(希望已排序)

我尝试过verify = True,在第一个POST到达数据表后使用POST和数据有效负载,使用json.dumps(data_payload_dict),字符串和下面显示的字典发送数据有效负载,仍然无法获得正确的(排序表)HTML。

我提交的排序数据有效载荷是在手动单击排序按钮之后直接从网络检查器中显示的URL编码表单数据中提取的:

dataSort = {"MailboxPath": "All", "MessageNamePattern": "**",
            "MsgNamePattern": "", "MessageId": "", "StartDate": "2018-06-03",
            "StartTime": "11%3A57", "StartAMPM": "AM", "EndDate": "2018-07-03",
            "EndTime": "11%3A58", "EndAMPM": "AM", "id": "", "OrderBy": "CreatedDateTime",
            "lastSortOrder": "CreatedDateTime","ascending": "Yes",
            "itemsPerPage": "100","currentPage": "1",
            "persistOrder": "Yes"}

请根据检查员签出form dataForm Data per Inspector 我唯一能想到的是,我没有以网站期望的格式提交有效载荷数据。这是请求标头部分Request Headers的顶部。也许我需要对表单数据有效载荷进行编码?

谢谢

0 个答案:

没有答案