当前位置:网站首页>System performance monitoring system
System performance monitoring system
2022-06-13 05:13:00 【I love Qianxi】
use python To write scripts to simplify the daily operation and maintenance work is python An important use of , stay linux in , It can be used ps,top,free Such a command to view , stay python in , A good way to get system information is psutil This third-party module , It is python System monitoring and process management tools , It is a powerful cross platform system management library , at present psutil The supported systems are linux,window os X etc.
One 、requests Request Library
1、 Introduce
requests Is an elegant and simple python HTTP Request Library ,requests Send request to get response data
2、 install
At terminal ( Command line tools ) Run the following command
pip install requests
pip list Can view installed Libraries
Be careful :
1、 If you want to install python In a virtual environment , Enter the virtual environment first, and then execute the above command
2、 If both... Are installed in the system python2, Installed again python3, Need to install python3 Environment :pip3 install requests
3、requests Basic use
1、 The import module
2、 send out get request , Get a response
3、 Get data from the response
1、 The import module
import requests
2、 Send a request , Get a response
response=requests.get("http://www.baidu.com")
3、 Get data from the response
print(response.text)
response Common properties :
response.test: Response string data
response.encoding: The character encoding used for printing
response.content: Print the binary data of the response
Set the code to utf-8:response.encoding="utf-8"
边栏推荐
猜你喜欢
Section 6 - pointers
External sort
Simple greedy strategy
QT brushes and brushes
Advanced C language - Section 1 - data storage
Sort (internal sort) + external sort
QT direction key to move focus
Case - the ArrayList collection stores student objects and traverses them in three ways
安装harbor(在线|离线)
C language learning log 11.7
随机推荐
Small project - household income and expenditure software (1)
动态规划-最长公共子串
Spread your wings and soar
【多线程】线程池核心类-ThreadPoolExecutor
RT thread console device initialization
[multithreading] thread pool core class -threadpoolexecutor
【线程/多线程】线程的执行顺序
详解OpenCV的函数cv::add(),并附各种情况的示例代码和运行结果
C language learning log 11.7
Robot pose description and coordinate transformation
Reductive elimination
MySQL8.0.13安装教程(有图)
C language learning log 12.14
C language learning log 12.25
C language learning log 10.6
Chapter 15 mechanism: Address Translation
Logical point
Course outline of market drawing 1- basic knowledge
Enhanced for loop
Introduction to R language 4--- R language process control