Compare commits
2 Commits
7bdbbf10b2
...
8e775c189f
Author | SHA1 | Date |
---|---|---|
Tanner Collin | 8e775c189f | 2 years ago |
Tanner Collin | 3d9274309a | 2 years ago |
2 changed files with 25 additions and 1 deletions
@ -0,0 +1,23 @@ |
||||
import time |
||||
import requests |
||||
|
||||
def test_search_api(): |
||||
num_tests = 100 |
||||
total_time = 0 |
||||
|
||||
for i in range(num_tests): |
||||
start = time.time() |
||||
|
||||
res = requests.get('http://127.0.0.1:33842/api/search?q=iphone') |
||||
res.raise_for_status() |
||||
|
||||
duration = time.time() - start |
||||
total_time += duration |
||||
|
||||
avg_time = total_time / num_tests |
||||
|
||||
print('Average search time:', avg_time) |
||||
|
||||
|
||||
if __name__ == '__main__': |
||||
test_search_api() |
Loading…
Reference in new issue