Search code examples
pythonrequesturllib

Python getting error of timeout while sending request


I actually on a project to code a program who test some combos. And I'm always getting the same error ==> HTTP Error 408: Request Timeout

I make some research and maybe it's my connection but I have another idea.

here is the data that I'm sending to the page

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")

and I think that the problem came from the authURL :

&authURL=authURL

before that I modify this line there was some random text but I replace it by "authURL" because I saw it on another script

here is the entire request :

    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')

What I expect i to successfully send the request with a code 200 not 408


Solution

  • Finally, after many research it was because the data have to be a dictionary under the form : (yes only that)

    data = {'email': email, 'password': password}
    

    and the auth URL was false but that wasn't related to problem the itself.