From e614ca67596cf0a7c2b39578b6a01b8de0d91e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Mon, 1 Dec 2014 12:06:13 -0700 Subject: [PATCH 1/3] Update Billmonster to Clint 0.4.1 The 'args' symbol is now imported differently, so we update the source code to work with the latest Clint. --- aessuccess.py | 3 ++- att.py | 3 ++- bankofamerica.py | 3 ++- capitalone.py | 3 ++- wellsfargo.py | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/aessuccess.py b/aessuccess.py index a731e54..7032e9c 100644 --- a/aessuccess.py +++ b/aessuccess.py @@ -6,7 +6,8 @@ from billmonster import _element_available -from clint import args +from clint.arguments import Args +args = Args() from clint.textui import colored, puts import keyring, sys diff --git a/att.py b/att.py index c25104d..23cfada 100644 --- a/att.py +++ b/att.py @@ -6,7 +6,8 @@ from billmonster import _element_available -from clint import args +from clint.arguments import Args +args = Args() from clint.textui import colored, puts import keyring, sys diff --git a/bankofamerica.py b/bankofamerica.py index 37eab38..18edff2 100644 --- a/bankofamerica.py +++ b/bankofamerica.py @@ -8,7 +8,8 @@ from billmonster import _element_available -from clint import args +from clint.arguments import Args +args = Args() from clint.textui import colored, puts import keyring, os, sys diff --git a/capitalone.py b/capitalone.py index ee113ef..f11b899 100644 --- a/capitalone.py +++ b/capitalone.py @@ -6,7 +6,8 @@ from billmonster import _element_available -from clint import args +from clint.arguments import Args +args = Args() from clint.textui import colored, puts import keyring, sys diff --git a/wellsfargo.py b/wellsfargo.py index 3a84f96..6db95a4 100644 --- a/wellsfargo.py +++ b/wellsfargo.py @@ -6,7 +6,8 @@ from billmonster import _element_available -from clint import args +from clint.arguments import Args +args = Args() from clint.textui import colored, puts import keyring, sys From 73b5cdbb5e32d793a633d5a3e086be5aa956a4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Mon, 1 Dec 2014 12:14:40 -0700 Subject: [PATCH 2/3] Add the missing 'index' argument The 'index' argument was added in 9d1b65a03b31a8434c59f97b6d47ddfc3761a6a6, but only bankofamerica.py was updated. This commit updates the rest of the files. --- aessuccess.py | 2 +- att.py | 2 +- capitalone.py | 2 +- wellsfargo.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aessuccess.py b/aessuccess.py index 7032e9c..c6fe778 100644 --- a/aessuccess.py +++ b/aessuccess.py @@ -13,7 +13,7 @@ import keyring, sys -def aessuccess(user=None, quit_when_finished=True, browser=None): +def aessuccess(user=None, quit_when_finished=True, browser=None, index=None): if not user: # Get the username from the command line arguments. diff --git a/att.py b/att.py index 23cfada..b5898de 100644 --- a/att.py +++ b/att.py @@ -13,7 +13,7 @@ import keyring, sys -def att(user=None, quit_when_finished=True, browser=None): +def att(user=None, quit_when_finished=True, browser=None, index=None): if not user: # Get the username from the command line arguments. diff --git a/capitalone.py b/capitalone.py index f11b899..e8e86ed 100644 --- a/capitalone.py +++ b/capitalone.py @@ -13,7 +13,7 @@ import keyring, sys -def capitalone(user=None, quit_when_finished=True, browser=None): +def capitalone(user=None, quit_when_finished=True, browser=None, index=None): if not user: # Get the username from the command line arguments. diff --git a/wellsfargo.py b/wellsfargo.py index 6db95a4..b97c4fe 100644 --- a/wellsfargo.py +++ b/wellsfargo.py @@ -13,7 +13,7 @@ import keyring, sys -def wellsfargo(user=None, quit_when_finished=True, browser=None): +def wellsfargo(user=None, quit_when_finished=True, browser=None, index=None): if not user: # Get the username from the command line arguments. From bcb89f6ad5a2fd0b5a9afb4404b2a502a73a6a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Mon, 1 Dec 2014 12:16:24 -0700 Subject: [PATCH 3/3] Make sure the browser quits in case of exception --- billmonster.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/billmonster.py b/billmonster.py index ab07041..2a138be 100755 --- a/billmonster.py +++ b/billmonster.py @@ -29,22 +29,24 @@ def main(): # Init the WebDriver. browser = webdriver.Firefox() + try: - for account in config._sections: + for account in config._sections: - # Grab the provider and the usernames. - provider = account - usernames = config._sections[account]['users'] - usernames = [x.strip() for x in usernames.split(',')] + # Grab the provider and the usernames. + provider = account + usernames = config._sections[account]['users'] + usernames = [x.strip() for x in usernames.split(',')] - index = 0 + index = 0 - # Run the script for each account user. - for user in usernames: - PROVIDERS[provider](user, False, browser, index) - index = index + 1 + # Run the script for each account user. + for user in usernames: + PROVIDERS[provider](user, False, browser, index) + index = index + 1 - browser.quit() + finally: + browser.quit() # Helper function to check whether an element exists yet on the page.