-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcache.py
28 lines (24 loc) · 876 Bytes
/
cache.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os, time
import requests
while True:
# Read donor lists
for file in os.listdir("donors"):
print(file)
try:
donor_object = requests.get("https://api.foldingathome.org/user/{}".format(file))
if donor_object.status_code == 200:
with open(os.path.join("donors", file), "w+") as fb:
fb.write(donor_object.text)
except Exception as e:
print(e)
# Read team lists
for file in os.listdir("teams"):
print(file)
try:
donor_object = requests.get("https://api.foldingathome.org/team/{}".format(file))
if donor_object.status_code == 200:
with open(os.path.join("teams", file), "w+") as fb:
fb.write(donor_object.text)
except Exception as e:
print(e)
time.sleep(5)