In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
51cto uses python's requests module to implement the login example code as follows:
-- coding:utf-8--
Import requests
Import re
Client = requests.session ()
Agent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
Header = {
"User-Agent": agent
}
URL = "http://home.51cto.com/index"
Def get_xsrf ():
# get xsrf value
Response = client.get (URL, headers=header)
Match_obj = re.search ('.name = "csrf-token" content= "(.)"', response.text)
If match_obj:
Return match_obj.group (1)
Else:
Return ""
Def _ 51cto_login (account, password):
# logging in to 51cto
Post_url = URL
Post_data = {
"_ csrf": get_xsrf ()
"LoginForm [username]": account
"LoginForm [password]": password
# although post has the following two parameters during packet capture analysis, the following two parameters are optional when actually logging in
# "LoginForm [remember me]": 0
# "login-button": "log in"
}
Response = client.post (post_url, data=post_data, headers=header)
# only after the above authentication is passed, can you see the login result by requesting the following page
Response = client.get (URL)
# print response.content
Print response.text
_ 51cto_login ("fill in real user name", "fill in real password")
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.