{"action":"created","issue":{"url":"https://api.github.com/repos/tejado/pgoapi/issues/175","repository_url":"https://api.github.com/repos/tejado/pgoapi","labels_url":"https://api.github.com/repos/tejado/pgoapi/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/tejado/pgoapi/issues/175/comments","events_url":"https://api.github.com/repos/tejado/pgoapi/issues/175/events","html_url":"https://github.com/tejado/pgoapi/issues/175","id":169225200,"number":175,"title":"rpc_api.py -> _build_subrequests needs more code","user":{"login":"Nostrademous","id":1735956,"avatar_url":"https://avatars.githubusercontent.com/u/1735956?v=3","gravatar_id":"","url":"https://api.github.com/users/Nostrademous","html_url":"https://github.com/Nostrademous","followers_url":"https://api.github.com/users/Nostrademous/followers","following_url":"https://api.github.com/users/Nostrademous/following{/other_user}","gists_url":"https://api.github.com/users/Nostrademous/gists{/gist_id}","starred_url":"https://api.github.com/users/Nostrademous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nostrademous/subscriptions","organizations_url":"https://api.github.com/users/Nostrademous/orgs","repos_url":"https://api.github.com/users/Nostrademous/repos","events_url":"https://api.github.com/users/Nostrademous/events{/privacy}","received_events_url":"https://api.github.com/users/Nostrademous/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":32,"created_at":"2016-08-03T20:24:57Z","updated_at":"2016-08-19T00:17:09Z","closed_at":null,"body":"For AttackGym - we need to be able to send repeated BattleAction objects/classes. Currently rpc_api.py only handles \"repeated\" base-types (i.e., ints, longs, strings) by accepting a \"list\" and iterating over it and then appending to the necessary attribute. Need improvement to support AttackGym protobuf.\r\n\r\n```\r\nmessage AttackGymMessage {\r\n\tstring gym_id = 1;\r\n\tstring battle_id = 2;\r\n\trepeated .POGOProtos.Data.Battle.BattleAction attack_actions = 3;\r\n\t.POGOProtos.Data.Battle.BattleAction last_retrieved_actions = 4;\r\n\tdouble player_latitude = 5;\r\n\tdouble player_longitude = 6;\r\n}\r\n```\r\n\r\nSomething like: NOTE - COMPLETELY UNTESTED CODE (also, I'm using old protobuf file structure)\r\n```\r\n                for (key, value) in entry_content.items():\r\n                    if isinstance(value, list):\r\n                        #self.log.error('Found list: %s - trying as repeated', key)\r\n                        for i in value:\r\n                            #self.log.error('Value is %s' % (type(i)))\r\n                            if isinstance(i, RpcSub.BattleAction):\r\n                                self.log.error('RpcSub.BattleAction Class')\r\n                                subsub_ext = get_class('pgoapi.protos.RpcSub_pb2.BattleAction')()\r\n                                try:\r\n                                    setattr(subsub_ext, 'Type', i.Type)\r\n                                    setattr(subsub_ext, 'action_start_ms', i.action_start_ms)\r\n                                    setattr(subsub_ext, 'duration_ms', i.duration_ms)\r\n                                    setattr(subsub_ext, 'target_index', i.target_index) \r\n                                    r = getattr(subrequest_extension, key)\r\n                                    r.append(subsub_ext)\r\n                                except Exception as e:\r\n                                    self.log.warning('Argument %s with value %s unknown inside %s (Exception: %s)', key, str(value), proto_name, str(e))\r\n\r\n                            else:\r\n                                try:\r\n                                    r = getattr(subrequest_extension, key)\r\n                                    r.append(i)\r\n                                except Exception as e:\r\n                                    self.log.warning('Arguement %s with value %s unknown inside %s (Exception %s)', key, i, proto_name, str(e))\r\n```\r\nThere are probably much sexier python methods to do this"},"comment":{"url":"https://api.github.com/repos/tejado/pgoapi/issues/comments/240895030","html_url":"https://github.com/tejado/pgoapi/issues/175#issuecomment-240895030","issue_url":"https://api.github.com/repos/tejado/pgoapi/issues/175","id":240895030,"user":{"login":"Nostrademous","id":1735956,"avatar_url":"https://avatars.githubusercontent.com/u/1735956?v=3","gravatar_id":"","url":"https://api.github.com/users/Nostrademous","html_url":"https://github.com/Nostrademous","followers_url":"https://api.github.com/users/Nostrademous/followers","following_url":"https://api.github.com/users/Nostrademous/following{/other_user}","gists_url":"https://api.github.com/users/Nostrademous/gists{/gist_id}","starred_url":"https://api.github.com/users/Nostrademous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nostrademous/subscriptions","organizations_url":"https://api.github.com/users/Nostrademous/orgs","repos_url":"https://api.github.com/users/Nostrademous/repos","events_url":"https://api.github.com/users/Nostrademous/events{/privacy}","received_events_url":"https://api.github.com/users/Nostrademous/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T00:17:09Z","updated_at":"2016-08-19T00:17:09Z","body":"@domeops that's from a pre 0.33 patch. It's not exactly correct. Code I pasted above works."}}
{"actor":{"display_login":"Nostrademous"}}