-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphql_test2.py
69 lines (65 loc) · 1.14 KB
/
graphql_test2.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
from graphqlclient import GraphQLClient
import json
import os
basedir=os.path.dirname(__file__)
client = GraphQLClient('https://demo-back-lifeapp.herokuapp.com')
result = client.execute("""
query {
loginUser(user: "carlosok", pass: "carlos"){
token
}
}
""")
print(type(result))
data=json.loads(result)
token = data['data']['loginUser']['token']
client.inject_token(token)
query="""
query {
getEvents{
_id
tenantID
centersID
isImported
internal_number
accession_number
uuid
altern_uuid
external_uuid
patient_type
date
date_string
time
time_string
personID
patient_doc_id
referring_professionalID
appointment_types
status
payment_status
resource_types
active
professionalsID
specialitiesID
proceduresID
appointment_reason
reception_comment
log {
date
time
action_type
detail
prev_data
new_data
user
}
created_at
created_by
}
}
"""
data = client.execute(query)
print(json.loads(data))
out=open(basedir+"/lifeapi.json",'w')
out.write(json.dumps( json.loads(data),indent=6 ) )
out.close()