When I use PHP to get cookie, it returns:
session_id=abih14s7l4lgo3splta7f6bd14; cccaa78fa9e13785130119a4924db0f4=96637ae... (more)
But when I use Python, it returns:
session_id=abih14s7l4lgo3splta7f6bd14
... the rest of cookies is lost.
My code Python:
res_post = requests.post(LOGIN_URL, data = {mydata})
cookies = dict(res_post.cookies.items())
Looks like you're using the requests library. The response.cookies is already a dictionary, so there's no need to cast it again.
You should access the cookies on the response like so:
response = requests.post(LOGIN_URL, data={mydata})
print response.cookies['session_id']
See here for more detail: http://docs.python-requests.org/en/latest/user/quickstart/#cookies
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With