-1

I'm pretty new in python requests, and I have made a simple program, just to login, in netflix. Here's my code.

url = 'https://www.netflix.com/login'

headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/80.0.3987.149 Safari/537.36'
}

r = requests.post(url, data={'userLoginId':'my-email', 'password': 'my-password'}, headers=headers)
print(r.status_code)

The output of status code is 200, so it's right

  • You should check status codes meaning [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) and also open the network tab on your browser console, login on netflix and compare if `200` is the status code it returns when logging in. – DarK_FirefoX Mar 31 '20 at 17:11

1 Answers1

1

You could use a Session to check the results of your login.

s = requests.Session()
r = s.post(url, data={'userLoginId':'my-email', 'password': 'my-password'}, headers=headers)
print(r.status_code)

Then you could check the cookies for your session with:

s.cookies.getdict()

Another example in this question: Using Python Requests: Sessions, Cookies, and POST

Mettool
  • 24
  • 5
  • The output is it: But if I change the password, its the same. `s = requests.Session() r = requests.post(url, data={'userLoginId':'email', 'password': 'password'}, headers=headers) print(s.cookies)` – Quique Fernandez Mar 31 '20 at 16:50
  • Sorry, `s.cookies` will return the object, but not the value. Use `s.cookies.get_dict()` to get the dictionary value of your cookies. I have updated my answer! – Mettool Mar 31 '20 at 16:57
  • The output of `s.cookies.getdict()` is `{}` – Quique Fernandez Mar 31 '20 at 17:40