-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcall_service.py
More file actions
36 lines (28 loc) · 882 Bytes
/
Copy pathcall_service.py
File metadata and controls
36 lines (28 loc) · 882 Bytes
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
# Sends RPCs to a SkirRPC service.
# See start_service.py for how to start one.
#
# Run with:
# python call_service.py
import skir
from skirout import service_skir, user_skir
if __name__ == "__main__":
service_client = skir.ServiceClient("http://localhost:8787/myapi")
print()
print("About to add 2 users: John Doe and Tarzan")
service_client.invoke_remote(
service_skir.AddUser,
service_skir.AddUserRequest(
user=user_skir.User.partial(user_id=42, name="John Doe")
),
)
service_client.invoke_remote(
service_skir.AddUser,
service_skir.AddUserRequest(user=user_skir.TARZAN),
{"X-Foo": "hi"},
)
print("Done")
found_user = service_client.invoke_remote(
service_skir.GetUser,
service_skir.GetUserRequest(user_id=123),
)
print(f"Found user: {found_user}")