Skip to content

Getting result in python using sendAndReceive or other methods #456

@hitabi

Description

@hitabi

I am trying to give a run command and get the response programatically in a python script.

I see that Session class has sendAndReceive method session.py#L591 which takes in a Message object. There is also Reflector class's sendAndReceive method reflector.py#L100 which takes in either a Factory such as ReflectionRequestFactory or a Message object. There is no document on it so my guess is that we have to add commands as arguments. Before I dump all my code I want to know if this is the only way or there some one-liner code that I overlooked.

command = 'run app.package.list'
args = Message.Argument(type=Message.Argument.STRING, string=command)
fac = ReflectionRequestFactory(Message.ReflectionRequest.INVOKE).setArguments([args])
res = self.session.reflector.sendAndReceive(fac)
print(res)

Gives error AttributeError: _pb on reflection_request.py:118
request.argument.add().MergeFrom(argument._pb())

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions