I would to measure the time of an HTTP request with python requests_futures even an exception occurs.
Although the elapsed
inherited from the original requests
module can be used to measure a successful request. But it can not be used to measure a failed request.
s.get("http://127.0.0.1").elapsed.total_seconds()
Is there a good way to measure the time even when an exception occurs? Thanks.
It is interesting question. You can add timer into an send function which in HTTPAdapter. But there is a disadvantage that you will get all time records(include redirect). Btw, i try to add timer into
session.send
but it return an unexpected time record.