http / https protocol features:
-no status
- When performing a second request based on the profile page, the server does not know at this request based on the request of log-in status
cookie:
- to let the server record client-related state
Solutions
- Processing Manual: cookie value acquired by the capture tool, the headers of the encapsulated cookie headers = { 'Cookie': 'xxxx'} (not recommended)
- Automatic processing: session session object:
-effect:
1. A request is sent
2. If the request is generated cookie, the cookie is automatically stored in the session
- Use:
1. Using the session object for sending simulated landing post (Cookie automatically stored in a session) ===> session = requests.Session () ===> session.post (xxxx)
2.session objects get request to initiate personal home page (carries cookie) session.get (xxxxx)