Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_build_sub_requests() accept protos messages as entry in subrequest_list #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pgoapi/rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import subprocess

from google.protobuf import message
from google.protobuf import internal as pb_internal

from importlib import import_module

Expand Down Expand Up @@ -185,7 +186,14 @@ def _build_sub_requests(self, mainrequest, subrequest_list):
self.log.debug("Subrequest class: %s", proto_classname)

for (key, value) in entry_content.items():
if isinstance(value, list):
val_type = type(type(value))
if val_type == pb_internal.python_message.GeneratedProtocolMessageType:
r = getattr(subrequest_extension, key)
for descriptor in value.DESCRIPTOR.fields:
vv = getattr(value, descriptor.name)
if vv is not None:
setattr(r, descriptor.name, vv)
elif isinstance(value, list):
self.log.debug("Found list: %s - trying as repeated", key)
for i in value:
try:
Expand Down