Files
ResInsight/ApplicationCode/GrpcInterface/Python/rips/AppInfo.py
Gaute Lindkvist a468532d7f #4457 Python: clean up grpc api, Python client API and make installable python package (#4456)
* gRPC: Make names more consistent

* gRPC: clean up case info and improve Python API for cases

* gRPC: much more object oriented Python interface

* Python: Make a proper pip-installable package

* Update rips Python package to auto generate setup.py with version number

* Python: add setup.py to gitignore

* Python: Update Python RIPS interface

* gRPC: Remove example client from cmake file and unit test

* gRPC: Fix up unit test after merge and hide warnings

* gRPC: fix up python client code
2019-06-03 14:33:16 +02:00

26 lines
735 B
Python

import grpc
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../generated'))
from Empty_pb2 import Empty
import AppInfo_pb2
import AppInfo_pb2_grpc
class AppInfo:
def __init__(self, channel):
self.appInfo = AppInfo_pb2_grpc.AppInfoStub(channel)
def versionMessage(self):
return self.appInfo.GetVersion(Empty())
def majorVersion(self):
return self.versionMessage().major_version
def minorVersion(self):
return self.versionMessage().minor_version
def patchVersion(self):
return self.versionMessage().patch_version
def versionString(self):
return str(self.majorVersion()) + "." + str(self.minorVersion()) + "." + str(self.patchVersion())