-
Notifications
You must be signed in to change notification settings - Fork 1
/
MEDIator_Client.py
executable file
·78 lines (40 loc) · 2.71 KB
/
MEDIator_Client.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
import unirest
# Define the REST Port as defined in the CommonConstants class.
REST_PORT = "80"
# Retrieve the users.
response = unirest.get("http://localhost:" + REST_PORT + "/")
print 'Retrieve the set of users'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Create Replica Set.
response = unirest.post("http://localhost:" + REST_PORT + "/replicasets", headers={ "Accept": "application/json" }, params={ "iUserID": 12, "iCollection": "TCGA-GBM", "iPatientID" : "TCGA-06-6701%2CTCGA-08-0831", "iStudyInstanceUID" : "1.3.6.1.4.1.14519.5.2.1.4591.4001.151679082681232740021018262895", "iSeriesInstanceUID" : "1.3.6.1.4.1.14519.5.2.1.4591.4001.179004339156422100336233996679" })
print 'Create a replica set'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Retrieve Replica Sets.
response = unirest.get("http://localhost:" + REST_PORT + "/replicasets/12")
print 'Retrieve replica sets of the user'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Retrieve Replica Set.
response = unirest.get("http://localhost:" + REST_PORT + "/replicaset/-4727115044472165798")
print 'Retrieve a replica set'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Delete Replica Set.
response = unirest.delete("http://localhost:" + REST_PORT + "/replicaset/12?replicaSetID=-5896416803618323002")
print 'Delete a replica set'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Replace Replica Set.
print 'Replace a replica set'
response = unirest.post("http://localhost:" + REST_PORT + "/replicaset/-4727115044472165798", headers={ "Accept": "application/json" }, params={"iStudyInstanceUID" : "1.3.6.1.4.1.14519.5.2.1.4591.4001.151679082681232740021018262895", "iSeriesInstanceUID" : "1.3.6.1.4.1.14519.5.2.1.4591.4001.179004339156422100336233996679" })
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Append Replica Set.
response = unirest.put("http://localhost:" + REST_PORT + "/replicaset/-4727115044472165798", headers={ "Accept": "application/json" }, params={"iCollection" : "TCGA-GBM"})
print 'Append a replica set'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Duplicate Replica Set.
response = unirest.post("http://localhost:" + REST_PORT + "/replicaset", headers={ "Accept": "application/json" }, params={ "userID" : "1234567", "replicaSetID": "-4727115044472165798"})
print 'Duplicate a replica set'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)
# Retrieve the users.
response = unirest.get("http://localhost:" + REST_PORT + "/")
print 'Retrieve the set of users'
print '%s\n%s\n%s' % (response.code, response.headers, response.body)