简体   繁体   中英

How to get cookies before making request in Python

I am basically running my personal project,but i'm stuck in some point.I am trying to make a login request to hulu.com using Python's request module but the problem is hulu needs a cookie and a CSRF token.When I inspected the request with HTTP Debugger it shows me the action URL and some request headers.But the cookie and the CSRF token was already there.But how to can do that with request module? I mean getting the cookies and the CSRF token before the post request? Any ideas? Thanks

首先创建一个会话,然后使用GET并使用session.cookies.get_dict() ,它将返回一个dict,并且应该具有您需要的适当值

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM