Created
May 18, 2022 05:10
-
-
Save polyglothacker/5efa2e2dde144e74a628cc024035ff6e 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 requests | |
import time | |
class APITest: | |
def __init__(self, api): | |
t1 = time.time() | |
requests.get(api) | |
t2 = time.time() | |
self.time_taken = t2 - t1 | |
def __str__(self): | |
return f'Time taken: {self.time_taken}' | |
if __name__ == "__main__": | |
a = APITest('https://api.drishti.com/v1/toyota/stations') | |
print(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this class as a base for developing higher benchmark test classes (or a single class) which can do
Where x => Either the # of the test (1, 2, 3 ...) or x => time
and y => number of test requests sent at a given time (approximately rps => requests per second)