This commit is contained in:
2016-05-30 17:50:21 -04:00
parent b8dfaff861
commit be7f518778
2 changed files with 14 additions and 5 deletions

View File

@@ -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)