-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbillmonster.py
executable file
·63 lines (46 loc) · 1.48 KB
/
billmonster.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python
from ConfigParser import ConfigParser
from selenium.common.exceptions import NoSuchElementException
from selenium import webdriver
import os
config = ConfigParser()
config.read(os.path.expanduser('~/.billmonster'))
def main():
from aessuccess import aessuccess
from att import att
from bankofamerica import bankofamerica
from capitalone import capitalone
from wellsfargo import wellsfargo
# Providers map.
PROVIDERS = {
'aessuccess': aessuccess,
'att': att,
'bankofamerica': bankofamerica,
'capitalone': capitalone,
'wellsfargo': wellsfargo,
}
# Init the WebDriver.
browser = webdriver.Firefox()
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(',')]
index = 0
# Run the script for each account user.
for user in usernames:
PROVIDERS[provider](user, False, browser, index)
index = index + 1
browser.quit()
# Helper function to check whether an element exists yet on the page.
def _element_available(browser, element):
def callback(browser):
try:
browser.find_element_by_css_selector(element)
except NoSuchElementException:
return False
else:
return True
return callback
if __name__ == '__main__':
main()