def task(id): requestCRUD = todoCRUD.SingleRequest(_id=int(id)) if (request.method == 'DELETE'): def delete_task(): response = app.config['tasks'].taskDelete(requestCRUD) return "Task Deleted :p" return Response(delete_task()) elif (request.method == 'PUT'): _data = request.get_json(silent=True) requestCRUD = todoCRUD.UpdateRequest(_id=int(id), title=_data['title'], description=_data['description'], status=_data['status']) def update(): response = app.config['tasks'].taskUpdate(requestCRUD) return MessageToJson(response) return Response(update(), content_type='application/json') else: def get_task(): response = app.config['tasks'].taskSingle(requestCRUD) return MessageToJson(response) return Response(get_task(), content_type='application/json')
def run(): with grpc.insecure_channel('localhost:50051') as channel: stub = todoCRUD_pb2_grpc.ToDoCRUDStub(channel) response = stub.taskDelete( todoCRUD_pb2.SingleRequest(_id="5ba0a00ba71a6235384ede36")) print(response)
def run(): with grpc.insecure_channel('localhost:50051') as channel: stub = todoCRUD_pb2_grpc.ToDoCRUDStub(channel) response = stub.taskSingle(todoCRUD_pb2.SingleRequest(_id=1)) print(response)