你好,我在python中用请求库重定向时出错

2024-10-01 00:33:24 发布

您现在位置:Python中文网/ 问答频道 /正文

你好,我需要登录到这个网站与一个在python中的请求 https://www.windstream.net/ 要使用webmail,您应该访问此url http://www.windstream.net/webmailRedirect.php?cache=0 当我带着一个请求去 我有这个结果,我不能去登录页,我不能登录

这是我的密码

import requests
# GetFakeUserAgent function to get a Fake User Agent this defined in another file you can use any User-Agent
Headers = {"User-Agent":str(GetFakeUserAgent())}
URL = "http://www.windstream.net/webmailRedirect.php?cache=0"
r = requests.session().get(URL, headers=Headers)
if r.status_code == requests.codes.ok:
    print("url -", r.url)
    print("Content -", r.content)

这是输出 你可以看到一个链接,而我在内容页中没有看到任何登录表单的数据

url - https://windstream.auth-gateway.net/saml/module.php/authbypass/firstbookend.php?AuthState=_438330a77741f64e61b46153c68f7681fe03eb6321%3ArZBRb4IwFIV_Db5NkA6mS8ziZowaJxk4Gb6Yq22grKUdLSD--hXNtix7XdL09p7TfPfmZFpLdW_bDS2w0iUB3odKZzcpaNJA2y-IthVwdrlcm2JpR1EQkbKmR9KXmXxQkhSa6pbicdbBLDSx3Jk5h5LilPzBGadjmcIFrtgF8v27M7uOEw0YNPwy90r2jkK8U7KhnIwHnu8MvdvBHeqFhEEbaTPkf3ZgIqWFqSYUcrqYaKY0GA9NGUWW65sgzPsnNSOpayhGlqLUYOi-hFIXpNxLaJkAbKxkI9qg0OcgT_0FX9Y49vLdW1gv8k57GQR0KfA8bAI6rDHCaFVgeeDhGc-XLImd6sC3zgphlvBBBvEp2sWhPPJtjp-8BuYTGqBnf50LmsRrB-JRdeW-mlmneueyrh-ZuD4qojQpF9Ox5T1arvu1sWt5008%3D&id=90a4fea287&coeff=0


Content -
 b'<!DOCTYPE html>\n<html lang="en">\n\t<head>\n\t\t<meta charset="utf-8" />\n\t\t<title>Redirecting...</title>\n\t\t<script type="text/javascript">\n\t\t\tif(typeof String.prototype.trim !== \'function\') {\n\t\t\t\tString.prototype.trim = function() {\n\t\t\t\t\treturn this.replace(/^\\s+|\\s+$/g, \'\');\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction getCookie(cname) {\n\t\t\t\tvar name = cname + "=";\n\t\t\t\tvar ca = document.cookie.split(\';\');\n\t\t\t\tfor(var i=0; i<ca.length; i++) {\n\t\t\t\t\tvar c = ca[i].trim();\n\t\t\t\t\tif (c.indexOf(name)==0) return decodeURIComponent(c.substring(name.length,c.length));\n\t\t\t\t}\n\t\t\t\treturn "";\n\t\t\t}\n\t\t\tfunction getHistoryDiff(id) {\n\t\t\t\tvar cookie_val = getCookie(\'bbp\');\n\t\t\t\tif (cookie_val) {\n\t\t\t\t\tid_parts = cookie_val.split(",")\n\t\t\t\t\tfor (var i in id_parts) {\n\t\t\t\t\t\tvar id_part_arr = id_parts[i].split(":");\n\t\t\t\t\t\tif (id_part_arr[0] == id) {\n\t\t\t\t\t\t\treturn parseInt(id_part_arr[1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn "";\n\t\t\t}\n\t\t\tfunction process() {\n\t\t\t\tvar history_diff = getHistoryDiff("90a4fea287");\n\t\t\t\tif (history_diff !== "") {\n\t\t\t\t\t// We\'ve returned and are going forward\n\t\t\t\t\tvar diff = (history_diff + 0 + 2);\n\t\t\t\t\tif (history_diff != 0 && diff != 0) {\n\t\t\t\t\t\twindow.history.go(diff);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// We are here the first time\n\t\t\t\t\tdocument.getElementById("history_val").value = window.history.length\n\t\t\t\t\tdocument.getElementById("history_form").submit();\n\t\t\t\t}\n\t\t\t}\n\t\t</script>\n\t</head>\n\t<body onload="process()">\n\t\t<form method="get" id="history_form">\n\t\t\t<input type="hidden" name="AuthState" value="_438330a77741f64e61b46153c68f7681fe03eb6321:rZBRb4IwFIV_Db5NkA6mS8ziZowaJxk4Gb6Yq22grKUdLSD--hXNtix7XdL09p7TfPfmZFpLdW_bDS2w0iUB3odKZzcpaNJA2y-IthVwdrlcm2JpR1EQkbKmR9KXmXxQkhSa6pbicdbBLDSx3Jk5h5LilPzBGadjmcIFrtgF8v27M7uOEw0YNPwy90r2jkK8U7KhnIwHnu8MvdvBHeqFhEEbaTPkf3ZgIqWFqSYUcrqYaKY0GA9NGUWW65sgzPsnNSOpayhGlqLUYOi-hFIXpNxLaJkAbKxkI9qg0OcgT_0FX9Y49vLdW1gv8k57GQR0KfA8bAI6rDHCaFVgeeDhGc-XLImd6sC3zgphlvBBBvEp2sWhPPJtjp-8BuYTGqBnf50LmsRrB-JRdeW-mlmneueyrh-ZuD4qojQpF9Ox5T1arvu1sWt5008=" />\n\t\t\t<input type="hidden" name="id" value="90a4fea287" />\n\t\t\t<input type="hidden" name="coeff" value="0" />\n\t\t\t<input type="hidden" name="history" id="history_val" value="" />\n\t\t</form>\n\t</body>\n</html>\n'

Process finished with exit code 0

如果你需要帐户尝试登录这个网站,你可以告诉我,我给你的帐户


Tags: nameidurlnetvaluecookietypediff