Interface automation test---cookies operation

Two ways:

 

1. Obtain the cookies object directly, which is suitable for situations that do not need to be encapsulated by yourself

   response.cookies

   requests.post(.....cookies=cookies)

 

2. Obtain the sessionid directly, and then encapsulate the cookies object by yourself, which is suitable for situations where you need to modify the cookies object

   sessionid = response.cookies["sessionid"]

   cookies={"sessionid":sessionid,"xxx":"yyy"}

   requests.post(.....cookies=cookies)

   

   

 

 

Guess you like

Origin blog.csdn.net/qq_19982677/article/details/107826858