-
Notifications
You must be signed in to change notification settings - Fork 258
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
Support to Retry on login, when fails #108
base: master
Are you sure you want to change the base?
Conversation
Hi there, welcome on board ! This is a nice idea, so I thing I'll merge once we fix the ongoing issues. Unfortunately in the current state, the edits make InstaLooter always ask for a username, which is not what we want. I'm gonna push some fixes to your branch so that it works as expected. In the meantime, please check the comments on the review, there are a few things you can probably fix yourself 😉 |
@@ -58,6 +58,8 @@ | |||
--traceback Print error traceback if any (debug). | |||
-W WARNINGCTL Change warning behaviour (same as python -W). | |||
[default: default] | |||
--try-count NUM, -c NUM Do the login process NUM times | |||
[default: 3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be moved to the Options - Credentials
section !
if i != int(args['--try-count']) - 1: | ||
console.warn('Wrong Username or Password') | ||
continue | ||
console.error(str(ve) + ', the number of tries exceeded') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just show the message here, the ValueError text is not needed since it can be displayed with --traceback
if needed.
if args["--traceback"]: | ||
traceback.print_exc() | ||
return 1 | ||
for i in range(int(args['--try-count'])): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block can be rewritten this way (with less tests / local variables):
args['--try-count'] = int(args['--try-count'])
while args['--try-count']:
try:
args['--username'] = six.moves.input('Username: ')
login(InstaLooter(), args)
return 0
except ValueError as ve:
args['--try-count'] -= 1
console.warn('Wrong Username or Password')
if args["--traceback"]:
traceback.print_exc()
return 1
And by the way, don't be shy and add your name here 😄 |
OKs, thanks I make the adjustments and commit again. |
This is a small change, just added an option --try-count NUM, -c NUM, which says, that the program will try NUM times(with default = 3), if login process fails, after NUM times, the program will exit.
Just a beginner PR, when wandering around code.