-
Notifications
You must be signed in to change notification settings - Fork 0
/
follow-test.py
43 lines (36 loc) · 2.32 KB
/
follow-test.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import time
import json
from urllib import request
if __name__ == "__main__":
urls = [
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0052.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0050.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0051.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0053.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0054.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0055.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0056.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0057.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0058.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2FFAE_w1_2_0059.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_1_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_2_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_2_1_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_2_2_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_3_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_4_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_5_0001.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_1_0002.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_2_0002.cbf",
"http://localhost:3000/api/imageview/show-image?path=id29%2Fref-FAE_2_1_0002.cbf",
]
data = json.dumps({"wavelength": 0,
"detector_distance": 0,
"detector_radius": 0}).encode()
req = request.Request("http://localhost:3000/api/imageview/start-follow", data=data)
request.urlopen(req).read()
for url in urls:
time.sleep(0.5)
content = json.loads(request.urlopen(url).read())
print("%s: %s" % (content, url))
req = request.urlopen("http://localhost:3000/api/imageview/stop-follow").read()