41 lines
895 B
Python
Executable File
41 lines
895 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from time import sleep, time
|
|
|
|
import requests
|
|
|
|
|
|
def main():
|
|
with open('circos') as f:
|
|
circos = f.read().split()
|
|
|
|
got_results = {}
|
|
|
|
while True:
|
|
for circo in circos:
|
|
if circo in got_results:
|
|
pass
|
|
# continue
|
|
|
|
resp = requests.get(f'http://localhost/refresh/{circo}')
|
|
if resp.status_code != 200:
|
|
print(circo)
|
|
print(resp.status_code)
|
|
continue
|
|
|
|
data = resp.json()
|
|
if data['status'] == 'OK':
|
|
# print("Résultats accessibles pour", circo)
|
|
got_results[circo] = time()
|
|
|
|
for circo, t in list(got_results.items()):
|
|
if time() - t >= 90:
|
|
del got_results[circo]
|
|
|
|
print("Sleeping...")
|
|
sleep(600)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|