Skip to content Skip to sidebar Skip to footer

Python Grequets To Get Time For Each Http Response Individually

I have written a python script using grequests to send http requests to server. The problem is that I need to get response time of each request. I have used hooks but still i can't

Solution 1:

grequests is just a wrapper around requests library. Just use the .elapsed attribute from the latest library, this way:

response_list = grequests.map(unsent_request, size=100)
for response in response_list:
    print(response.elapsed and response.elapsed.total_seconds() or "failed")

Post a Comment for "Python Grequets To Get Time For Each Http Response Individually"