pokemongo-api-demo
pokemongo-api-demo copied to clipboard
[simulation] handle exception in heartbeat
fixes the script exiting whenever heartbeat has an issue (which seems to happen often)
loveit
Can we actually do this retry on the api_req
function? This way, we can get some sort of retry guarantee while authenticating a user. Just in case Niantic releases the game to another 26 countries tomorrow, we can still make sure that nothing breaks :P
amended. how's that?
Someone can please make a tutorial how can we locally merge the pull requests to use the latest version?
Take your api_req, add while True: to the top of it, indent everything below by one tab.
it still gives error here the error message in infinite loop
I am getting this error after a while
Using "[simulation] handle exception in heartbeat" pull request
pull request : https://github.com/leegao/pokemongo-api-demo/pull/1
my main file : http://pastebin.com/4fxJuYNv
error message : https://i.snag.gy/Hl9r8q.jpg
@MonsterMMORPG the payload is empty so u need to put a check there. I have a different implementation but I do something like
if not response.payload:
return None
This is in the heartbeat process and I have put a while loop on heartbeat and if it returns None the request is repeated with a break.
@therealssj can you show me where should i put in in this file? http://pastebin.com/4fxJuYNv
@MonsterMMORPG it's not a single line but multiple changes.
Line 230:
payload = response.payload[0]
To:
if not reponse.payload:
return None
Line 290:
h = heartbeat(api_endpoint, access_token, response)
To:
h = None
while h is None:
h = heartbeat(api_endpoint, access_token, response)
print("Heartbeat Error, Sleeping for 2 second..")
time.sleep(2)
It's a dirty implementation but works for now
@therealssj awesome ty. 1 more thing. can you show me how can i play a sound when an error occurred? i am trying to run infinite loop and i dont want to check it constantly :D
@MonsterMMORPG http://stackoverflow.com/questions/4467240/play-simple-beep-with-python-without-external-library
The issue is I don't have any idea how to detect global errors so I can play sound
On Jul 17, 2016 16:12, "Mehul" [email protected] wrote:
@MonsterMMORPG https://github.com/MonsterMMORPG http://stackoverflow.com/questions/4467240/play-simple-beep-with-python-without-external-library
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/leegao/pokemongo-api-demo/pull/1#issuecomment-233181351, or mute the thread https://github.com/notifications/unsubscribe-auth/AD9Q4t_jRy3cx6050ygvRg3korqyELHUks5qWipMgaJpZM4JOHSd .
any idea why I keep getting a index out of range at line 271
@Twinters007 same here
it is because the servers are screwed and errors are not handled properly
@memelyfe can you check whether the searching algorithm can be improved or not? i am running 3 instances and nothing worthy appears in my city :(
I think I just did.
https://github.com/leegao/pokemongo-api-demo/blob/simulation/main.py#L282
What I suspect is happening is the algorithm is supposed to go x steps, then start over, but in this line, it sets [original latitude] to [currently used latitude]. so when it resets, it doesn't actually go back to home. This combined with going only forward along the walk instead of forward and backward would explain why everything shifts upwards.
I also got rid of the walk = getNeighbors(), because the first walk already gets 20 steps (10+ and 10-), so I think finding neighbors each iteration isn't what we want.
UPDATE: So I think it has to do with S2 and Hillbert Curves, so I tried using just a grid of points, but it doesn't seem to work with the heartbeat and everything. Ideas?
@Twinters007 so what changes do we need to make to fix? ty