Closed m3at closed 8 years ago
Looks good. You can also do it then like this:
api.set_position(35.682975, 139.762738, 2.0)
What do you mean with "doesn't appear to be working"? Try the --debug parameter for pokecli.py if it doesn't work for you and check the request/response in detail.
Thanks for your confirmation!
You're right I forgot to provide context sorry... I want to do a random walk, for that I did this simple recursion:
import sched, time
api = pgoapi.PGoApi()
api.login(username="john.doe@gmail.com",password="#",provider="google")
# simple class with lat/lon/elevation
mov = mover(35.682975, 139.762738, 2.0)
def update_pos(sc):
# move a little
mov.randomize_one_setp()
# get new position
_pos = mov.get_pos()
api.set_position(*_pos)
status = api.call() # status = []
# loop
_cron(sc)
def _cron(s):
if time.time() - t_zero < 60:
# add a random delay about a second later
s.enter(np.random.randn()/1+1, 1, update_pos, argument=(s,))
s.run()
s = sched.scheduler(time.time, time.sleep)
t_zero = time.time()
_cron(s)
I confirm that the generated positions are correct after plotting on a map.
I said doesn't appear to be working because after a few minutes and a kilometer walked my hatched eggs are still displayed with the same distance.
--debug
parameter of pokecli.py display nothing abnormal.
However when I run the example spiral_poi_search.py
I get:
Traceback (most recent call last):
File "spiral_poi_search.py", line 231, in <module>
main()
File "spiral_poi_search.py", line 162, in main
find_poi(api, position[0], position[1])
File "spiral_poi_search.py", line 186, in find_poi
pokekey = get_key_from_pokemon(pokemon)
File "spiral_poi_search.py", line 198, in get_key_from_pokemon
return '{}-{}'.format(pokemon['spawnpoint_id'], pokemon['pokemon_data']['pokemon_id'])
KeyError: 'spawnpoint_id'
Any idea?
At first, get the latest example. Just merged a pull request with the new argument naming in spiral_poi_search.py (name of spawnpoint_id changed).
In regards to the hatched eggs... I didnt try that myself so... But I read something, that you have to walk better a straight line and no circles or something due to the measurement of the distance server side.
Indeed I pulled and spiral_poi_search.py
is fine now, nice.
Ok thanks for the answer and tips! 👍 I will try that tonight and hopefully close the issue
I'm sure it is obvious but I couldn't find why it doesn't appear to be working (I searched the wiki and issues)...
What is the correct way to use
api.set_position
? (api.get_inventory()
works fine)I tried: