如何获取执行以下请求时生成的cookie?
res = requests.get('http://netflix.com', headers=headers)
# "Cookie": "b.voKfK9l.bmFuaWdhbnMgdXNlciBpZCAy=MTI4OTQ1NDMzMw; btpdb.voKfK9l.dGZjLjExMzIxMzQ=U0VTU0lPTg; btpdb.voKfK9l.dGZjLjE5MDM5Mzc=REFZUw; asearch=14333870421168910222; NSC_ED1-xxx=ffffffff09c8016b45525d5f4f58455e445a4a422d6a; NetflixCookies=persistent; dsrc=STRWEB_SIGNUP; custTrans=Y; isaffiliate=N; _ga=GA1.2.1091094536.1433192681; lastHitTime=1433387048919; nflxsid=10222.1433387048920; DVisitor=002~afd26f51-c034-49c2-b00d-242e471031d4~1433387042115~false~1433387048921~; dnmp="MDAxOjgwMDM1MzA1OjE0MzMzODcwNDg5MjE6Ojo="; obrd=true; btpdb.voKfK9l.dGZjLjE5MDM5NDI=REFZUw; btpdb.voKfK9l.dGZjLjYyODU4NA=REFZUw; RT=r%3Dhttp%253A%252F%252Fwww.netflix.com%252FKids%26scrt%3D1433387209323; __utma=131134992.1091094536.1433192681.1433384047.1433386536.3; __utmc=131134992; __utmz=131134992.1433384047.2.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); VisitorId=002~TkZDRENILU1DLUFQWkhKSkY0MTZQR0ZXTFpHMjBHTlFMSjFOS1JMVQ~1433192615342~false~1433390331561~; nmp=MDAxOjUxNDAxOTE1OjE0MzMxOTI2ODczMTY6OnRya2lkPTIwMjY1MzpodHRwJTNBJTJGJTJGd3d3Lm5ldGZsaXguY29tJTJGV2lNb3ZpZSUyRjgwMDM4MTYyOg..; profilesNewSession=0; profilesNewUser=0; fbsr_163114453728333=YvlysQWMQZWSD5skRzBPg7E3V_w4vKyJaGbO26rKsNM.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUUNxWmlSYU0tXzVqNDlfaGx3SWtuYXRwQ1JrS1RLRzJacmRpUHdCeDQ3Q0hLRzhJSjhfMTFuN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9TTWf1GEXYoyk-IvXGTbQwOo7CdyeOl96dj_2O7TmqrGJNl7kTgAckUXkvdFMSrEuR31twvP1zvl46mn3RIQqvj3gf_vkRW5h_f6xrjw7oLFJM2cRwGxgIxmsA4n7ai7PXlWAYM1ts-OxaIAX7Z6oq_3CUQf75ZCPic8RMYq9mlIdVWZWX13V-v2iaIZ769wbmiFXso7tJeDu5bEA2RC4NDJyX13-qCmh%26bt%3Ddbl; lhpuuid-wihome-11756="81bbb5a8-eebf-4dc2-881f-6f321622f596_ROOT:US-en-US"; JSESSIONID=BFCF0B4D38F3A9B61518CF88E4685651; tlr=US|1433441554843; cL=1433441632684%7C143344117037716678%7C143344117066172612%7C%7C18%7CIOS3P437CZFCTORM2IDRFPUL34; memclid=TkZDRENILU1DLUFQWkhKSkY0MTZQR0ZXTFpHMjBHTlFMSjFOS1JMVQ""",
获得res.cookie似乎有点不透明。我如何获取实际的cookie值?
答案 0 :(得分:2)
来自文档:
http://docs.python-requests.org/en/latest/user/quickstart/#cookies
r.cookies['example_cookie_name']
你也可以使用dict .get()
答案 1 :(得分:0)
仅按要求价值。
requests.get(url).cookies