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
Post a Comment