想知道爬虫目标页面的二级目录的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)

相关文章:

  • 2022-02-27
  • 2021-06-25
  • 2021-11-30
  • 2021-10-14
  • 2022-12-23
  • 2021-04-26
  • 2021-09-07
  • 2021-12-14
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案