stuff
This commit is contained in:
15
testAPI.py
15
testAPI.py
@@ -1,10 +1,19 @@
|
||||
import requests as r
|
||||
import time
|
||||
|
||||
def testAPI(times):
|
||||
def testAPI(times=100, sleep=2):
|
||||
errors = 0
|
||||
|
||||
for i in range(times):
|
||||
res = r.post('http://codeland.bytedev.co:2000/api/run', data={'code': 'pwd'})
|
||||
if res.status_code != 200: errors +=1
|
||||
try:
|
||||
res = r.post(
|
||||
'http://codeland.bytedev.co:2000/api/run',
|
||||
data={'code': 'pwd'}
|
||||
)
|
||||
if res.status_code != 200: errors += 1
|
||||
print(i, res.status_code)
|
||||
except:
|
||||
print('caught error')
|
||||
errors += 1
|
||||
time.sleep(sleep)
|
||||
print('errors ', errors)
|
||||
Reference in New Issue
Block a user