Python requests http post data with cookies -


i have written script in order login account:

import requests session=requests.session() post_data={'login':'login', 'username':'user', 'password':'password'} cookies=session.cookies post_response=session.post(url='https://www.mywebsite.com', cookies=cookies, data=post_data) print post_response.content 

when run web site returns me error:

it seems browser doesn't allow cookies, please enable cookies first.

just guess:

session = requests.session() session.get('https://www.mywebsite.com/login.html')  post_data = {'login':'login', 'username':'user', 'password':'password'} post_response = session.post(url='https://www.mywebsite.com', data=post_data) print post_response.content 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -