Reputation: 197
I am trying to login to a page using Python requests (2.10.0).
Code:
payload = {
'user_login': '[email protected]',
'user_pass': 'xxx',
'rememberme': '1'
}
with requests.session() as sess:
resp = sess.post(URL_LOGIN, data=payload)
print resp.cookies
This should have returned multiple cookies. When I see in Chrome developer tools, I see the following:
However, when I print it on console, I see only the last cookie. Rest all are lost. The same login password works in browser. Due to this, subsequent request from same session fails.
RequestsCookieJar [Cookie wordpress_test_cookie=WP+Cookie+check for some.domain].
Why are the other cookies not preserved in session. All other subsequent requests doesn't recognize the login and I suspect its because of the missing cookies.
Could anyone help please?
Upvotes: 0
Views: 1241
Reputation: 197
Thanks @Padraic - I was using the 'id' attribute but 'name' was to be used. Thanks for that. wp-submit was not required. Thanks again.
Upvotes: 1