Python 发送请求时出现超时错误
Python getting error of timeout while sending request
我实际上在一个项目中编写一个测试一些组合的程序。而且我总是遇到同样的错误 ==> HTTP 错误 408:请求超时
我做了一些研究,也许这是我的联系,但我有另一个想法。
这是我要发送到页面的数据
data = "userLoginId={}&password={}&rememberMe=false&flow=websiteSignUp&mode=login&action=loginAction&withFields=rememberMe%2CnextPage%2CuserLoginId%2Cpassword%2CcountryCode%2CcountryIsoCode&authURL=authURL%2FEcpWPKhtag%3D&nextPage=&showPassword=&countryCode=%2B33&countryIsoCode=FR".format(email, password).encode("utf-8")
我认为问题出在 authURL 上:
&authURL=authURL
在我修改此行之前有一些随机文本,但我将其替换为 "authURL" 因为我在另一个脚本中看到它
这是整个请求:
request_login = urllib.request.Request("https://www.netflix.com:443/fr/Login",
data = data,
headers ={
'Host': 'www.netflix.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'fr-FR',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://www.netflix.com/fr/Login',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': 330},
unverifiable = True,
method = 'POST')
我希望我成功发送代码为 200 而不是 408 的请求
最后,经过多次研究,这是因为数据必须是以下形式的字典:(是的,只有那个)
data = {'email': email, 'password': password}
并且身份验证 URL 是错误的,但这与问题本身无关。
我实际上在一个项目中编写一个测试一些组合的程序。而且我总是遇到同样的错误 ==> HTTP 错误 408:请求超时
我做了一些研究,也许这是我的联系,但我有另一个想法。
这是我要发送到页面的数据
data = "userLoginId={}&password={}&rememberMe=false&flow=websiteSignUp&mode=login&action=loginAction&withFields=rememberMe%2CnextPage%2CuserLoginId%2Cpassword%2CcountryCode%2CcountryIsoCode&authURL=authURL%2FEcpWPKhtag%3D&nextPage=&showPassword=&countryCode=%2B33&countryIsoCode=FR".format(email, password).encode("utf-8")
我认为问题出在 authURL 上:
&authURL=authURL
在我修改此行之前有一些随机文本,但我将其替换为 "authURL" 因为我在另一个脚本中看到它
这是整个请求:
request_login = urllib.request.Request("https://www.netflix.com:443/fr/Login",
data = data,
headers ={
'Host': 'www.netflix.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'fr-FR',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://www.netflix.com/fr/Login',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': 330},
unverifiable = True,
method = 'POST')
我希望我成功发送代码为 200 而不是 408 的请求
最后,经过多次研究,这是因为数据必须是以下形式的字典:(是的,只有那个)
data = {'email': email, 'password': password}
并且身份验证 URL 是错误的,但这与问题本身无关。