python请求并获取cookie

时间:2019-10-21 13:46:07

标签: python cookies request

我有此请求:

mysql

这是我的代码:

Host: subdomain.test.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
X-Requested-With: XMLHttpRequest
Content-Length: 66
Connection: close
Referer: https://subdomain.test.com/login
Cookie: _gcl_au=1.1.1234502517.1571027917; _ga=GA1.2.763005402.1571027922; _fbp=fb.1.1571027923235.548273364; _hjid=9ae69402-9cd0-4e93-8e11-e6fdd78de9c3; PHPSESSID=12345c63db530475e3480d3c4e12345; _gid=GA1.2.1079574959.1571624463; _gat_UA-4593965-2=1

email=this@email.com&shownPassword=test123QWE&password=test123QWE

这是响应:

import requests
from requests import session

payload = {
    'email' : 'this@email.com',
    'shownPassword' : 'test123QWE',
    'password' : 'test123QWE'
}


with session() as c:
    c.post('https://subdomain.test.com/login', data=payload)
    response = c.get('https://subdomain.test.com/login')

    print(response.cookies)

所以我的问题是,我如何获得Cookie?

谢谢

0 个答案:

没有答案
相关问题