我正在使用Python 2.7将发帖请求及其客户编号发送到billdesk网站,以获取其详细信息。
我在传递以下请求时收到无效输入错误。 我还尝试了使用json编码的表单数据。
url="https://pgi.billdesk.com/pgidsk/pgmerc/rvvnlaj/RVVNLAJConfirm.jsp"
payload={
"service":"BILL",
"txtCustomerID":"110331033880",
"txtEmail":"mymailid@gmail.com"
}
headers={
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding":"gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36",
"Upgrade-Insecure-Requests": "1",
"Content-Type":"application/x-www-form-urlencoded",
"Connection":"keep-alive",
"Host":"pgi.billdesk.com"
}
z=requests.post(url,headers=headers,data=payload)
print z.content
我希望帐单中包含详细信息,但是我收到无效输入错误。
<td > </td>
<td bgcolor="#ff9966" class="textrvvnl">Invalid Inputs</td>
<td > </td>
</tr>
<tr>
<td > </td>
<td bgcolor="#ff9966" class="textrvvnl">
</td>
<td > </td>
</tr>
请告知我是否以错误的格式传递表单数据。
答案 0 :(得分:1)
您使用了错误的标题,请尝试改用以下标题:
headers={
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0",
"Referer": "https://pgi.billdesk.com/pgidsk/pgmerc/rvvnlaj/RVVNLAJDetails.jsp"
}
希望这会有所帮助