Пример #1
0
 def __init__(self):
     self.application = proto.Application()
     self.applicationIdentifier = proto.ApplicationIdentifier()
     self.device = proto.Device()
     self.deviceIdentifier = proto.DeviceIdentifier()
     self.deviceList = proto.DeviceList()
     self.err = None
Пример #2
0
 def delete_device(self, dev_id):
     req = proto.DeviceIdentifier()
     req.app_id = self.app_id
     req.dev_id = dev_id
     meta = self.__create_metadata()
     try:
         return self.client.DeleteDevice(req, 60, meta)
     except grpc.RpcError as err:
         raise RuntimeError("Error while deleting the",
                            " device: {}".format(err.code().name))
Пример #3
0
 def device(self, devID):
     req = proto.DeviceIdentifier()
     req.app_id = self.app_id
     req.dev_id = devID
     meta = self.__create_metadata()
     try:
         res = self.client.GetDevice(req, TIME_OUT, meta)
         return res
     except grpc.RpcError as err:
         raise RuntimeError("Error while getting the",
                            " device: {}".format(err.code().name))