0%

python | 模块 httpstat

这个模块可以分析网络耗时。

同样,你也可以用 curl 做到相同的事情。


参考资料


这个库可以做到

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Connected to 34.227.211.26:80 from 192.168.31.55:57333

HTTP/1.1 200 OK
Date: Wed, 22 Dec 2021 16:59:04 GMT
Content-Type: application/json
Content-Length: 254
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

Body stored in: /var/folders/_w/m_m732l53hb_bzmctrr1p3940000gn/T/tmp9hgz2m77

DNS Lookup TCP Connection Server Processing Content Transfer
[ 30ms | 283ms | 285ms | 1ms ]
| | | |
namelookup:30ms | | |
connect:313ms | |
starttransfer:598ms |
total:599ms

这里只说一个注意点,就是,当你的系统同时有多个 python 环境的时候,可以用下面的命令运行这个模块

python3.7 -m httpstat httpbin.org/get
请我喝杯咖啡吧~