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

API Validation - Killswitch on API Change #5826

Merged
merged 6 commits into from
Nov 24, 2016
Merged

Conversation

eRobot1
Copy link
Contributor

@eRobot1 eRobot1 commented Nov 20, 2016

Short Description:

Check if Niantic API is equal to current API. If not, warn and prompt user .

Fixes/Resolves/Closes (please use correct syntax):

  • Running old bot when Niantic force updates version on client

Validate if Official API has changed

Validate if Official API has changed
@mention-bot
Copy link

@ElliotRobot1, thanks for your PR! By analyzing the history of the files in this pull request, we identified @douglascamata, @TheSavior and @rawgni to be potential reviewers.

@houkop
Copy link

houkop commented Nov 20, 2016

Valid api is 0.45.0, not 0.43.0

@eRobot1
Copy link
Contributor Author

eRobot1 commented Nov 20, 2016

@houkop correct. Sorry, was testing. Corrected.

@tiagoAnon
Copy link

tiagoAnon commented Nov 21, 2016

I believe the safe approach would be to check the current version on every login. The bot will have to login every time the session becomes stale. If Niantic changes the api version mid-botting, they will probably flag the account immediately.

Instead of prompting if the user wants to take a risk a flag should be added to the config.json with the default value being false.

EDIT: Also, in order to support higher versions in the future, we should actually check if our version is the same of bigger than Niantic's minimum version. Just in case we start going faster than Niantic one day :)

By the way, Niantic just changed the minimum API version to 0.47.0

@reigelgallarde
Copy link

should be better if we can add this on the config file...
default to true on the python script. So we can change the config file if we really don't care about the version (example, I'm developing, the version doesn't matter, log me in...)

 ....
    "check_niantic_api": {
      "enabled": false
    },
 ....

also, I think the better place for this is on api_wrapper.py. We could add another def check_niantic_api. And use it inside def login... this way, it would always check every time it logs in. But yes, there's should be an option to turn this off.. then maybe add a warning when this is off...

Anyway, just a suggestion... I'm not a python programmer.. 😄

@showei
Copy link

showei commented Nov 21, 2016

@reigelgallarde I have a bash script wrapping run.sh to check api version and switch accounts every hour, not sure if it's a better place to hold it.

@eRobot1
Copy link
Contributor Author

eRobot1 commented Nov 21, 2016

@tiagoAnon @reigelgallarde Took your advice. Added logic to API Wrapper to handle to re-loggin on stale session. Added flag to config as well to override API check.

@eRobot1 eRobot1 changed the title API Validation API Validation - Killswitch on API Change Nov 21, 2016
@eRobot1
Copy link
Contributor Author

eRobot1 commented Nov 23, 2016

@ChaosMarc can you merge this?

link = "https://pgorelease.nianticlabs.com/plfe/version"
f = urllib.urlopen(link)
myfile = f.read()
self.config.check_niantic_api

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is line 100 an extra?

@solderzzc
Copy link
Contributor

solderzzc commented Nov 24, 2016

👍

Approved with PullApprove

@solderzzc solderzzc merged commit 6416d10 into PokemonGoF:master Nov 24, 2016
@cierzniak
Copy link

Why kill switch was merged into master but no dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants