【问题标题】:Is there a way to get the timestamp of http/s get request?有没有办法获取http/s get请求的时间戳?
【发布时间】:2021-12-27 18:58:23
【问题描述】:

我对使用 requests 和 BeautifulSoup 进行网络抓取很感兴趣。

raw = requests.get(url)
print(raw.text)

当我运行代码时,我注意到结果延迟了多达 7 分钟。有没有办法在我执行 get 请求后获取 requests 库的时间戳?

我认为这些请求不是实时的。

【问题讨论】:

    标签: python html python-requests python-requests-html


    【解决方案1】:

    您想要您发出请求或服务器收到请求的时间戳吗?

    如果你想要你提出请求的时间,我会使用

    import time
    
    request_time = time.time()
    

    我不确定服务器收到它的时间,除非服务器在 json 响应或其他东西中告诉你

    【讨论】:

    • 感谢您的回复。我想要服务器回复请求时的时间戳
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2020-04-10
    • 2020-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-17
    相关资源
    最近更新 更多