Files
daily_publish/cleanup_test.py
T

15 lines
529 B
Python

import requests
r = requests.get('http://192.168.31.240:41733/api/reports?projectId=1').json()
print('Reports in project 1:')
for rep in r:
print(' ', rep['id'], rep['fileName'])
if 'test.html' in rep['fileName']:
rid = rep['id']
r2 = requests.delete(f'http://192.168.31.240:41733/api/reports/{rid}')
print(f' Deleted test.html (id={rid}): {r2.status_code}')
# Verify
r3 = requests.get('http://192.168.31.240:41733/api/projects/1').json()
print('Project now has', r3['reportCount'], 'reports')