-
Notifications
You must be signed in to change notification settings - Fork 262
Support to Retry on login, when fails #108
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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] | ||
|
|
||
| Template: | ||
| The default filename of the pictures and videos on Instagram doesn't show | ||
|
|
@@ -161,15 +163,19 @@ def main(argv=None): | |
| return 0 | ||
|
|
||
| elif args['login']: | ||
| try: | ||
| args['--username'] = six.moves.input('Username: ') | ||
| login(InstaLooter(), args) | ||
| return 0 | ||
| except ValueError as ve: | ||
| console.error(ve) | ||
| if args["--traceback"]: | ||
| traceback.print_exc() | ||
| return 1 | ||
| for i in range(int(args['--try-count'])): | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| try: | ||
| args['--username'] = six.moves.input('Username: ') | ||
| login(InstaLooter(), args) | ||
| return 0 | ||
| except ValueError as ve: | ||
| if i != int(args['--try-count']) - 1: | ||
| console.warn('Wrong Username or Password') | ||
| continue | ||
| console.error(str(ve) + ', the number of tries exceeded') | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| if args["--traceback"]: | ||
| traceback.print_exc() | ||
| return 1 | ||
|
|
||
| if args['-W'] not in WARNING_ACTIONS: | ||
| print("Unknown warning action: {}".format(args['-W'])) | ||
|
|
@@ -204,17 +210,36 @@ def main(argv=None): | |
| extended_dump=args['--extended-dump'], | ||
| ) | ||
|
|
||
| try: | ||
| login(looter, args) | ||
| if args['--time']: | ||
| timeframe = get_times_from_cli(args['--time']) | ||
| else: | ||
| timeframe = None | ||
| except ValueError as ve: | ||
| console.error(ve) | ||
| if args["--traceback"]: | ||
| traceback.print_exc() | ||
| return 1 | ||
| userEntered = False | ||
| passEntered = False | ||
| if args['--username'] != None: | ||
| userEntered = True | ||
| if args['--password'] != None: | ||
| passEntered = True | ||
| if userEntered and passEntered: | ||
| args['--try-count'] = 1 | ||
|
|
||
| for i in range(int(args['--try-count'])): | ||
| try: | ||
| if not userEntered: | ||
| args['--username'] = six.moves.input('Username: ') | ||
| login(looter, args) | ||
| if args['--time']: | ||
| timeframe = get_times_from_cli(args['--time']) | ||
| else: | ||
| timeframe = None | ||
| except ValueError as ve: | ||
| if i != int(args['--try-count']) - 1: | ||
| console.warn('Wrong Username or Password') | ||
| continue | ||
|
|
||
| if userEntered and passEntered: | ||
| console.error(str(ve)) | ||
| else: | ||
| console.error(str(ve) + ', the number of tries exceeded') | ||
| if args["--traceback"]: | ||
| traceback.print_exc() | ||
| return 1 | ||
|
|
||
| try: | ||
| post_token = args['<post_token>'] | ||
|
|
||
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 - Credentialssection !