如何从python中的请求中获取超时?

问题描述

我怎样才能得到它的超时时间?

cmd.Parameters.AddWithValue("@PPrice",sqlDbType.NVarChar).Value =
double.TryParse(productPrice,out money);
           cmd.Parameters.AddWithValue("@PSelPrice",sqlDbType.NVarChar).Value=
double.TryParse(productSelPrice,out money);

解决方法

我提出以下想法:

在请求的标头属性中,您可以获取发出请求的日期。

import requests
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0'}
r = requests.get('https://httpbin.org/ip',headers=headers)

r.headers #return something like that: 

{'Date': 'Mon,31 May 2021 19:18:48 GMT','Content-Type': 'application/json','Content-Length': '32','Connection': 'keep-alive','Server': 'gunicorn/19.9.0','Access-Control-Allow-Origin': '*','Access-Control-Allow-Credentials': 'true'}

您可以使用下一行访问日期:

r.headers['Date']