Last active
June 25, 2022 15:07
-
-
Save asharma327/f4b310582c0c86a6cf161ea82dc6aeaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import requests | |
def time_function(func): | |
start = time.time() | |
func() | |
end = time.time() | |
return (end-start) | |
get_api_data = lambda: requests.get("https://api.apispreadsheets.com/data/P93eUlGtyrDCuJjK/") | |
request_times = [] | |
for x in range(10): | |
request_times.append(time_function(get_api_data)) | |
print(sum(request_times)/float(len(request_times))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment