Support to Retry on login, when fails#108
Support to Retry on login, when fails#108nimitbhardwaj wants to merge 1 commit intoalthonos:masterfrom
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 😉 |
| -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.
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.
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.
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.