From 2052b74bffed8b6ee7e458f8dc50dc504fcf7f46 Mon Sep 17 00:00:00 2001 From: Andrej Shadura Date: Mon, 30 Apr 2018 11:06:34 +0200 Subject: Import Upstream version 0.3.1 --- PKG-INFO | 49 +++++++++++++ README | 30 ++++++++ ofxhome.egg-info/PKG-INFO | 49 +++++++++++++ ofxhome.egg-info/SOURCES.txt | 10 +++ ofxhome.egg-info/dependency_links.txt | 1 + ofxhome.egg-info/entry_points.txt | 2 + ofxhome.egg-info/top_level.txt | 1 + ofxhome.egg-info/zip-safe | 1 + ofxhome/__init__.py | 128 ++++++++++++++++++++++++++++++++++ setup.cfg | 8 +++ setup.py | 29 ++++++++ 11 files changed, 308 insertions(+) create mode 100644 PKG-INFO create mode 100644 README create mode 100644 ofxhome.egg-info/PKG-INFO create mode 100644 ofxhome.egg-info/SOURCES.txt create mode 100644 ofxhome.egg-info/dependency_links.txt create mode 100644 ofxhome.egg-info/entry_points.txt create mode 100644 ofxhome.egg-info/top_level.txt create mode 100644 ofxhome.egg-info/zip-safe create mode 100644 ofxhome/__init__.py create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..e9bca55 --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,49 @@ +Metadata-Version: 1.0 +Name: ofxhome +Version: 0.3.1 +Summary: ofxhome.com financial institution lookup REST client +Home-page: https://github.com/captin411/ofxhome +Author: David Bartle +Author-email: captindave@gmail.com +License: MIT License +Description: ofxhome + ========= + + REST client for the web service provided by ofxhome.com + + ofxhome.com provides a way to discover the Open Financial Exchange (OFX) URL's and financial institution IDs for banks and other financial institutions. + + ofxhome is a sort of "DNS" for financial institution OFX URLs and IDs. + + This client by itself is not all that useful unless you are coupling it with software that needs this lookup capability. + + other modules + ============= + + ofxclient - a python API that downloads transactions from banks + + example + ======= + + from ofxhome import OFXHome + + s = OFXHome.search("USAA") + " 's' contains a list that has entries like so: + " { name: 'USAA Federal Savings Bank', id: '483' } + " { name: 'USAA Investment Mgmt Co', id: '665' } + for item in s: + print item['id'] _ item['name'] + bank = OFXHome.lookup(item.id) + print bank.name _ bank.fid _ bank.url _ bank.brokerid # OR + print bank['name'] _ bank['fid'] _ bank['url'] _ bank['brokerid'] + +Keywords: ofx,Open Financial Exchange,bank search,ofxhome,ofxhome.com +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Utilities +Classifier: License :: OSI Approved :: MIT License diff --git a/README b/README new file mode 100644 index 0000000..417956d --- /dev/null +++ b/README @@ -0,0 +1,30 @@ +ofxhome +========= + +REST client for the web service provided by ofxhome.com + +ofxhome.com provides a way to discover the Open Financial Exchange (OFX) URL's and financial institution IDs for banks and other financial institutions. + +ofxhome is a sort of "DNS" for financial institution OFX URLs and IDs. + +This client by itself is not all that useful unless you are coupling it with software that needs this lookup capability. + +other modules +============= + +ofxclient - a python API that downloads transactions from banks + +example +======= + +from ofxhome import OFXHome + +s = OFXHome.search("USAA") +" 's' contains a list that has entries like so: +" { name: 'USAA Federal Savings Bank', id: '483' } +" { name: 'USAA Investment Mgmt Co', id: '665' } +for item in s: + print item['id'] _ item['name'] + bank = OFXHome.lookup(item.id) + print bank.name _ bank.fid _ bank.url _ bank.brokerid # OR + print bank['name'] _ bank['fid'] _ bank['url'] _ bank['brokerid'] diff --git a/ofxhome.egg-info/PKG-INFO b/ofxhome.egg-info/PKG-INFO new file mode 100644 index 0000000..e9bca55 --- /dev/null +++ b/ofxhome.egg-info/PKG-INFO @@ -0,0 +1,49 @@ +Metadata-Version: 1.0 +Name: ofxhome +Version: 0.3.1 +Summary: ofxhome.com financial institution lookup REST client +Home-page: https://github.com/captin411/ofxhome +Author: David Bartle +Author-email: captindave@gmail.com +License: MIT License +Description: ofxhome + ========= + + REST client for the web service provided by ofxhome.com + + ofxhome.com provides a way to discover the Open Financial Exchange (OFX) URL's and financial institution IDs for banks and other financial institutions. + + ofxhome is a sort of "DNS" for financial institution OFX URLs and IDs. + + This client by itself is not all that useful unless you are coupling it with software that needs this lookup capability. + + other modules + ============= + + ofxclient - a python API that downloads transactions from banks + + example + ======= + + from ofxhome import OFXHome + + s = OFXHome.search("USAA") + " 's' contains a list that has entries like so: + " { name: 'USAA Federal Savings Bank', id: '483' } + " { name: 'USAA Investment Mgmt Co', id: '665' } + for item in s: + print item['id'] _ item['name'] + bank = OFXHome.lookup(item.id) + print bank.name _ bank.fid _ bank.url _ bank.brokerid # OR + print bank['name'] _ bank['fid'] _ bank['url'] _ bank['brokerid'] + +Keywords: ofx,Open Financial Exchange,bank search,ofxhome,ofxhome.com +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Utilities +Classifier: License :: OSI Approved :: MIT License diff --git a/ofxhome.egg-info/SOURCES.txt b/ofxhome.egg-info/SOURCES.txt new file mode 100644 index 0000000..2c69c46 --- /dev/null +++ b/ofxhome.egg-info/SOURCES.txt @@ -0,0 +1,10 @@ +README +setup.cfg +setup.py +ofxhome/__init__.py +ofxhome.egg-info/PKG-INFO +ofxhome.egg-info/SOURCES.txt +ofxhome.egg-info/dependency_links.txt +ofxhome.egg-info/entry_points.txt +ofxhome.egg-info/top_level.txt +ofxhome.egg-info/zip-safe \ No newline at end of file diff --git a/ofxhome.egg-info/dependency_links.txt b/ofxhome.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ofxhome.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/ofxhome.egg-info/entry_points.txt b/ofxhome.egg-info/entry_points.txt new file mode 100644 index 0000000..bca5a81 --- /dev/null +++ b/ofxhome.egg-info/entry_points.txt @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ofxhome.egg-info/top_level.txt b/ofxhome.egg-info/top_level.txt new file mode 100644 index 0000000..acd88fc --- /dev/null +++ b/ofxhome.egg-info/top_level.txt @@ -0,0 +1 @@ +ofxhome diff --git a/ofxhome.egg-info/zip-safe b/ofxhome.egg-info/zip-safe new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ofxhome.egg-info/zip-safe @@ -0,0 +1 @@ + diff --git a/ofxhome/__init__.py b/ofxhome/__init__.py new file mode 100644 index 0000000..6ca3aeb --- /dev/null +++ b/ofxhome/__init__.py @@ -0,0 +1,128 @@ +import urllib +from datetime import datetime +from xml.dom.minidom import parseString + +__version__ = '0.3.1' + +API_URL='http://www.ofxhome.com/api.php' + +class OFXHome: + + @staticmethod + def lookup(id): + """ + Get financial institution OFX info given an ofxhome.com 'id' + + Returns: Institution + + bank = OFXHome.lookup('456') + print bank.name _ bank.url _ bank.fid + """ + return Institution(_xml_request({ 'lookup': id })) + + @staticmethod + def all(): + """ + List every available bank that ofxhome.com knows about + + Returns: InstitutionList + + See also: OFXHome.search() + """ + return search() + + @staticmethod + def search(name=None): + """ + Search for a financial institution by name. + + Returns: InstitutionList + + If no name is provided , or a name of None is provided then + it is the same as calling OFXHome.all(). Note that passing a + string of '' will not be the same thing and will result in no + results. + + banks = OFXHome.search('America') + for res in banks: + print res.id _ res.name + + bank = OFXHome.lookup(res.id) + print bank.name _ bank.url _ bank.fid + """ + if name is None: + params = { 'all': 'yes' } + else: + params = { 'search': name } + return InstitutionList(_xml_request(params)) + +def _attr(node,name): + return node.getAttribute(name) + +def _text(parent,name): + rc = [] + for node in parent.getElementsByTagName(name)[0].childNodes: + if node.nodeType == node.TEXT_NODE: + rc.append(node.data) + return ''.join(rc) + +def _xml_request(params=None): + encoded = urllib.urlencode(params) + xml = urllib.urlopen("%s?%s" % (API_URL,encoded)).read() + return xml + +#--------------------------------------------- +class InstitutionList: + def __init__(self,xml): + root = parseString(xml).documentElement + data = [] + for node in root.getElementsByTagName('institutionid'): + data.append({ 'name': _attr(node,'name'), 'id': _attr(node,'id') }) + self.items = data + self.xml = xml + + @staticmethod + def from_file(file): + return InstitutionList(open(file,'r').read()) + + def __getitem__(self,item): + return self.items[item] + + def __len__(self): + return len(self.items) + + def __iter__(self): + for i in self.items: + yield i + + def __str__(self): + return self.xml +#--------------------------------------------- +class Institution: + def __init__(self,xml): + + dom = parseString(xml) + root = dom.documentElement + + self.id = _attr(root,'id') + self.name = _text(root,'name') + self.fid = _text(root,'fid') + self.org = _text(root,'org') + self.url = _text(root,'url') + self.brokerid = _text(root,'brokerid') + self.ofxfail = _text(root,'ofxfail') + self.sslfail = _text(root,'sslfail') + self.lastofxvalidation = datetime.strptime(_text(root,'lastofxvalidation'),"%Y-%m-%d %H:%M:%S") + self.lastsslvalidation = datetime.strptime(_text(root,'lastsslvalidation'),"%Y-%m-%d %H:%M:%S") + + self.xml = xml + + def __getitem__(self,item): + return self.__dict__[item] + + def __setitem__(self,item,value): + self.__dict__[item] = value + + @staticmethod + def from_file(file): + return Institution(open(file,'r').read()) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..d9d658a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,8 @@ +[egg_info] +tag_svn_revision = 0 +tag_build = +tag_date = 0 + +[aliases] +release = register sdist bdist_egg upload + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0bdc1dc --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +from setuptools import setup, find_packages + +setup(name='ofxhome', + version="0.3.1", + description="ofxhome.com financial institution lookup REST client", + long_description=open("./README", "r").read(), + classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Utilities", + "License :: OSI Approved :: MIT License", + ], + keywords='ofx, Open Financial Exchange, bank search, ofxhome, ofxhome.com', + author='David Bartle', + author_email='captindave@gmail.com', + url='https://github.com/captin411/ofxhome', + license='MIT License', + packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), + include_package_data=True, + zip_safe=True, + install_requires=[ ], + test_suite = 'tests', + entry_points=""" + """, + ) -- cgit v1.2.3