aurum: make examples for guide accepted/tizen/unified/20221103.165802
authorHosang Kim <hosang12.kim@samsung.com>
Wed, 2 Nov 2022 06:40:30 +0000 (15:40 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 2 Nov 2022 10:28:50 +0000 (19:28 +0900)
Change-Id: I045c6b6c720c57deb0922bf232fbf46ae5ff1a76

examples/python/helloworld.py [new file with mode: 0644]

diff --git a/examples/python/helloworld.py b/examples/python/helloworld.py
new file mode 100644 (file)
index 0000000..2dbf7dc
--- /dev/null
@@ -0,0 +1,17 @@
+import grpc
+from aurum_pb2 import *
+from aurum_pb2_grpc import BootstrapStub
+
+def run():                                                         
+    with grpc.insecure_channel('localhost:50051') as channel:      
+#   If you have a proxy problem, use the below code instead of the above code.
+#   with grpc.insecure_channel('localhost:50051', options=(('grpc.enable_http_proxy', 0),)) as channel:
+        stub = BootstrapStub(channel)
+        getDeviceTime(stub)
+
+def getDeviceTime(stub):
+    response = stub.getDeviceTime(ReqGetDeviceTime(type='SYSTEM'))
+    print(response)
+
+if __name__ == '__main__':                                         
+    run()