hacks/scrapers/amexscraper.py

38 lines
1.0 KiB
Python
Raw Normal View History

2013-03-11 22:22:36 +00:00
#!/Users/sneak/dev/venv-2.7/bin/python
2013-03-11 22:26:02 +00:00
# shouts to @AskAmex for being a replicant and
# David Bartle for making a very difficult-to-use ofxclient library
2013-03-11 22:26:42 +00:00
# 2013 jeffrey paul <sneak@datavibe.net>
2013-03-11 22:26:02 +00:00
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2
2013-03-11 22:22:36 +00:00
from pprint import pformat
import os
import re
import json
2013-03-11 22:54:52 +00:00
from ofxclient.request import Builder as OFXClientBuilder
from scraper import FinancialScraper, MockInstitution
2013-03-11 22:22:36 +00:00
2013-03-11 22:54:52 +00:00
class AmexScraper(FinancialScraper):
2013-03-27 07:32:34 +00:00
def isBank(self):
return False
def isCC(self):
return True
2013-03-11 22:54:52 +00:00
def getInstitution(self):
return MockInstitution(
2013-03-11 22:22:36 +00:00
user=self.user,
2013-03-11 22:54:52 +00:00
password=self.password,
url='https://online.americanexpress.com/myca/ofxdl/desktop/' +
'desktopDownload.do?request_type=nl_ofxdownload',
org='AMEX',
fid='3101'
2013-03-11 22:22:36 +00:00
)
2013-03-11 22:54:52 +00:00
2013-03-11 22:22:36 +00:00
def main():
s = AmexScraper(
user=os.environ['AMEXUSERNAME'],
password=os.environ['AMEXPASSWORD']
)
print json.dumps(s.scrape())
if __name__=="__main__":
main()