In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you an example analysis of making wheels with React.js+Egg.js. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Download: use React.js+Egg.js to build wheels
The script is as follows:
1. Introduce the required third-party package
#! / usr/bin/env python3 #-*-coding: utf-8-*-import requests # import reimport json # from bs4 import BeautifulSoup
two。 Set the request header and set the request parameters. You need to convert the Python dictionary to json string.
Url = 'http://beanhome.com/user/login'header = {"Content-Type":' application/json', "User-Agent": "Mozilla/5.0 (Macintosh) Intel Mac OS X 10: 14: 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36 "} # Python dictionary data into json, you need to use json.dumpsdata = {" email ":" common@moviebook.com "," passwd ":" 123456 "} # simulated login through session, each request with sessionsess = requests.Session () f = sess.post (url, data=json.dumps (data), headers=header)
3. Print the result after a successful login
Print (json.loads (f.text)) # soup = BeautifulSoup (f.content, "html.parser") # {'status': 1,' msg': 'operation succeeded,' time': 1565317698, 'element': {' id': 1, 'uid': 1,' name': 'common',' email': 'common@moviebook.com',' company':', 'type': 1' 'title':' ordinary user'}}
4. Print menu results
Url = 'http://beanhome.com/user/getMenu'# get menu f = sess.post (url,headers=header) print (json.loads (f.text))
5. Print configuration option results
# get the configuration option url= 'http://beanhome.com/user/getOptionList'result = sess.post (url, headers=header) # print (json.loads (result.text)) for JMagol k in json.loads (result.text) [' element'] .items (): print (JMagre k)
The above is the example of using React.js+Egg.js to build wheels that Xiaobian shared with you. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.