ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/Reminder/shellmc.py
Revision: 1145
Committed: 2009-03-14T22:48:45-07:00 (16 years, 3 months ago) by douglas
Content type: text/x-python
File size: 772 byte(s)
Log Message:
Improved handling!

File Contents

# User Rev Content
1 douglas 1145 # Shell MasterCard
2 douglas 1131 #
3     # Douglas Thrift
4     #
5     # $Id$
6    
7     from datetime import datetime
8     import re
9     import website
10    
11     class Bank(website.Website):
12 douglas 1145 PAYMENT_DUE = re.compile(r'[A-Z][a-z]{2}\. \d{1,2}, \d{4}')
13    
14 douglas 1131 def __init__(self, username, password, debug):
15     website.Website.__init__(self, debug)
16    
17 douglas 1145 self.browser.open('http://www.shellmc.accountonline.com/')
18 douglas 1131 self.browser.select_form(name = 'LOGIN')
19    
20     self.browser['USERNAME'] = username
21     self.browser['PASSWORD'] = password
22    
23     self.browser.submit()
24    
25 douglas 1145 def due(self, account):
26 douglas 1131 try:
27 douglas 1145 return datetime.strptime(self.PAYMENT_DUE.search(self.Soup(self.browser.follow_link(text_regex = account)).find(text = re.compile('Payment Due')).findNext(text = self.PAYMENT_DUE)).group(0), '%b. %d, %Y').date()
28 douglas 1131 finally:
29     self.browser.back()

Properties

Name Value
svn:keywords Id
svn:mergeinfo