想知道爬虫目标页面的二级目录的url的响应时间并打印出来:
使用的方法是:
import requests r=requests.get("http://www.baidu.com") r.elapsed.mircoseconds
requests库里面的方法elapsed方法是发出请求到响应时间:
requests的文档的地址是:http://docs.python-requests.org/en/latest/api/?highlight=elapsed#requests.Response.elapsed
- elapsed = None
-
The amount of time elapsed between sending the request and the arrival of the response (as a timedelta)