Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Session maintains a session

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Requests.get ('http://httpbin.org/cookies/set?number=123456')

Requests.get ('http://httpbin.org/cookies')

The above two request requests (whether get or post) are equivalent to opening the windows of two browsers. They are irrelevant.

After logging in to a system, if you need to do something in the login state, how do you maintain the session?

S=requests.Session ()

Url1=' http://127.0.0.1/wordpress/wp-login.php' data1= {'log':'xxxx','pwd':'xxxxxx'}

# Login

R1=s.post (url1,data=data1)

Print (r1.url)

# you need to be logged in to complete the operation

Url2=' http://127.0.0.1/wordpress/wp-admin/user-new.php'

Data2= {'user_login':'test1','email':'1234567@163.com','createuser':' add user'}

R2=s.post (url2,data=data2)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report