Skip to content

Commit

Permalink
Update example.py
Browse files Browse the repository at this point in the history
  • Loading branch information
konomae committed Aug 22, 2014
1 parent 518f5fc commit 43afcf0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
# coding: utf-8
import json
import os
import lastpass
from lastpass import (
Vault,
LastPassIncorrectYubikeyPasswordError,
LastPassIncorrectGoogleAuthenticatorCodeError
)

with open(os.path.join(os.path.dirname(__file__), 'credentials.json')) as f:
credentials = json.load(f)
Expand All @@ -11,19 +15,19 @@

try:
# First try without a multifactor password
vault = lastpass.Vault.open_remote(username, password)
except lastpass.LastPassIncorrectGoogleAuthenticatorCodeError as e:
vault = Vault.open_remote(username, password)
except LastPassIncorrectGoogleAuthenticatorCodeError as e:
# Get the code
multifactor_password = input('Enter Google Authenticator code:')

# And now retry with the code
vault = lastpass.Vault.open_remote(username, password, multifactor_password)
except lastpass.LastPassIncorrectYubikeyPasswordError as e:
vault = Vault.open_remote(username, password, multifactor_password)
except LastPassIncorrectYubikeyPasswordError as e:
# Get the code
multifactor_password = input('Enter Yubikey password:')

# And now retry with the code
vault = lastpass.Vault.open_remote(username, password, multifactor_password)
vault = Vault.open_remote(username, password, multifactor_password)


for index, i in enumerate(vault.accounts):
Expand Down

0 comments on commit 43afcf0

Please sign in to comment.