Closed trippyhat closed 8 years ago
https://github.com/tejado/pgoapi/blob/master/pgoapi/pgoapi.py#L108-L128
This is using the getattr magic method (http://python-reference.readthedocs.io/en/latest/docs/dunderattr/getattr.html) to add the "get_player" request if it exists as an RPC defined method (https://github.com/tejado/pgoapi/blob/81e786cabf027a1c8fbd1e9a07e1c11aa3d8ee8b/pgoapi/protos/POGOProtos_src/Networking/Requests/RequestType.proto#L10)
@elliottcarlson Thanks. Could you explain a bit how the name get_player
is able to get the Enum GET_PLAYER = 2;
, which then gets the function definition defined in GetPlayerMessage.proto?
So RequestType.Value("get_player")
returns the enum GET_PLAYER = 2
? How does this then get the corresponding GetPlayerMessage.proto?
Over converting the string "get_player" to GetPlayer, add "Message to it and instantiate dynamically an object with this name (GetPlayerMessage) https://github.com/tejado/pgoapi/blob/master/pgoapi/rpc_api.py#L144
@tejado Thanks! I think I get it now.
Can someone give a friendly walkthrough of how
get_player()
works?The client program instantiates a pgoapi object:
In pgoapi/pgoapi.py, all I see is:
But I'm confused at this point. Where is
self.get_player()
defined? ie, the actual code that handles that function? I tried grepping through the files fordef get_player
but it's never declared anywhere.