summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2016-06-27 01:01:05 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-04-30 11:06:35 +0200
commit36236df28b6c3dc2284d254c4e92dfbeacc1b78b (patch)
treec83296282080b7b6a01bc2ad7f3090297e107ecd
parente5a019d1a60a00ebf82a9a3802a1d65c1938a1bd (diff)
parent21c8dffe98f1136ca158f7ec0df4bd3e39f743a9 (diff)
Import Debian changes 0.3.3-1
python-ofxhome (0.3.3-1) unstable; urgency=medium * New upstream version. * Orphan the package.
-rw-r--r--PKG-INFO2
-rw-r--r--debian/changelog7
-rw-r--r--debian/control4
-rw-r--r--ofxhome.egg-info/PKG-INFO2
-rw-r--r--ofxhome/__init__.py26
-rw-r--r--ofxhome/tests/test_suite.py96
-rw-r--r--setup.py2
7 files changed, 83 insertions, 56 deletions
diff --git a/PKG-INFO b/PKG-INFO
index daf535c..3651b8e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ofxhome
-Version: 0.3.2
+Version: 0.3.3
Summary: ofxhome.com financial institution lookup REST client
Home-page: https://github.com/captin411/ofxhome
Author: David Bartle
diff --git a/debian/changelog b/debian/changelog
index 251ac9e..8b86a6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-ofxhome (0.3.3-1) unstable; urgency=medium
+
+ * New upstream version.
+ * Orphan the package.
+
+ -- Clint Adams <clint@debian.org> Mon, 27 Jun 2016 01:01:05 +0200
+
python-ofxhome (0.3.2-1) unstable; urgency=medium
* New upstream version.
diff --git a/debian/control b/debian/control
index b9e8524..8a38ec4 100644
--- a/debian/control
+++ b/debian/control
@@ -1,12 +1,12 @@
Source: python-ofxhome
Section: python
Priority: optional
-Maintainer: Clint Adams <clint@debian.org>
+Maintainer: Debian QA Group <packages@qa.debian.org>
Build-Depends: debhelper (>= 9)
, dh-python
, python-all (>= 2.7~)
, python-setuptools
-Standards-Version: 3.9.6
+Standards-Version: 3.9.8
Homepage: https://github.com/captin411/ofxhome
X-Python-Version: >= 2.6
diff --git a/ofxhome.egg-info/PKG-INFO b/ofxhome.egg-info/PKG-INFO
index daf535c..3651b8e 100644
--- a/ofxhome.egg-info/PKG-INFO
+++ b/ofxhome.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ofxhome
-Version: 0.3.2
+Version: 0.3.3
Summary: ofxhome.com financial institution lookup REST client
Home-page: https://github.com/captin411/ofxhome
Author: David Bartle
diff --git a/ofxhome/__init__.py b/ofxhome/__init__.py
index c18a369..4ae9310 100644
--- a/ofxhome/__init__.py
+++ b/ofxhome/__init__.py
@@ -1,8 +1,16 @@
-import urllib
+try:
+ # Python3 case
+ from urllib.parse import urlencode
+ from urllib.request import urlopen
+except ImportError:
+ # Python2 case
+ from urllib import urlencode
+ from urllib2 import urlopen
+
from datetime import datetime
from xml.dom.minidom import parseString
-__version__ = '0.3.2'
+__version__ = '0.3.3'
API_URL='http://www.ofxhome.com/api.php'
@@ -29,7 +37,7 @@ class OFXHome:
See also: OFXHome.search()
"""
- return search()
+ return OFXHome.search()
@staticmethod
def search(name=None):
@@ -70,8 +78,8 @@ def _text(parent,name):
return ''.join(rc)
def _xml_request(params=None):
- encoded = urllib.urlencode(params)
- xml = urllib.urlopen("%s?%s" % (API_URL,encoded)).read()
+ encoded = urlencode(params)
+ xml = urlopen("%s?%s" % (API_URL,encoded)).read()
return xml
#---------------------------------------------
@@ -86,7 +94,9 @@ class InstitutionList:
@staticmethod
def from_file(file):
- return InstitutionList(open(file,'r').read())
+ with open(file, 'r') as f:
+ data = f.read()
+ return InstitutionList(data)
def __getitem__(self,item):
return self.items[item]
@@ -128,4 +138,6 @@ class Institution:
@staticmethod
def from_file(file):
- return Institution(open(file,'r').read())
+ with open(file, 'r') as f:
+ data = f.read()
+ return Institution(data)
diff --git a/ofxhome/tests/test_suite.py b/ofxhome/tests/test_suite.py
index 92f0b98..9d04930 100644
--- a/ofxhome/tests/test_suite.py
+++ b/ofxhome/tests/test_suite.py
@@ -6,51 +6,55 @@ import datetime
class InstitutionTestCase(unittest.TestCase):
def testGoodParse(self):
- xml = testfile('scottrade.xml').read()
+ with testfile('scottrade.xml') as f:
+ xml = f.read()
i = Institution(xml)
- self.assertEquals(i.id,'623')
- self.assertEquals(i.name,'Scottrade, Inc.')
- self.assertEquals(i.fid,'777')
- self.assertEquals(i.org,'Scottrade')
- self.assertEquals(i.brokerid,'www.scottrade.com')
- self.assertEquals(i.url,'https://ofxstl.scottsave.com')
- self.assertEquals(i.ofxfail,'0')
- self.assertEquals(i.sslfail,'4')
- self.assertEquals(i.lastofxvalidation,datetime.datetime(2012,8,13,22,28,10))
- self.assertEquals(i.lastsslvalidation,datetime.datetime(2011,9,28,22,22,22))
- self.assertEquals(i.xml, xml)
+ self.assertEqual(i.id,'623')
+ self.assertEqual(i.name,'Scottrade, Inc.')
+ self.assertEqual(i.fid,'777')
+ self.assertEqual(i.org,'Scottrade')
+ self.assertEqual(i.brokerid,'www.scottrade.com')
+ self.assertEqual(i.url,'https://ofxstl.scottsave.com')
+ self.assertEqual(i.ofxfail,'0')
+ self.assertEqual(i.sslfail,'4')
+ self.assertEqual(i.lastofxvalidation,datetime.datetime(2012,8,13,22,28,10))
+ self.assertEqual(i.lastsslvalidation,datetime.datetime(2011,9,28,22,22,22))
+ self.assertEqual(i.xml, xml)
def testOptionalBroker(self):
- xml = testfile('jpmorgan.xml').read()
+ with testfile('jpmorgan.xml') as f:
+ xml = f.read()
i = Institution(xml)
- self.assertEquals(i.id,'435')
- self.assertEquals(i.name,'JPMorgan Chase Bank')
- self.assertEquals(i.fid,'1601')
- self.assertEquals(i.org,'Chase Bank')
- self.assertEquals(i.brokerid,'')
- self.assertEquals(i.url,'https://www.oasis.cfree.com/1601.ofxgp')
- self.assertEquals(i.ofxfail,'0')
- self.assertEquals(i.sslfail,'0')
- self.assertEquals(i.lastofxvalidation,datetime.datetime(2014,8,17,22,23,35))
- self.assertEquals(i.lastsslvalidation,datetime.datetime(2014,8,17,22,23,34))
- self.assertEquals(i.xml, xml)
+ self.assertEqual(i.id,'435')
+ self.assertEqual(i.name,'JPMorgan Chase Bank')
+ self.assertEqual(i.fid,'1601')
+ self.assertEqual(i.org,'Chase Bank')
+ self.assertEqual(i.brokerid,'')
+ self.assertEqual(i.url,'https://www.oasis.cfree.com/1601.ofxgp')
+ self.assertEqual(i.ofxfail,'0')
+ self.assertEqual(i.sslfail,'0')
+ self.assertEqual(i.lastofxvalidation,datetime.datetime(2014,8,17,22,23,35))
+ self.assertEqual(i.lastsslvalidation,datetime.datetime(2014,8,17,22,23,34))
+ self.assertEqual(i.xml, xml)
def testFromFile(self):
i = Institution.from_file( testfile_name('scottrade.xml') )
- self.assertEquals(i.id,'623')
- self.assertEquals(i['id'],'623')
+ self.assertEqual(i.id,'623')
+ self.assertEqual(i['id'],'623')
def testDictKeys(self):
- xml = testfile('scottrade.xml').read()
+ with testfile('scottrade.xml') as f:
+ xml = f.read()
i = Institution(xml)
- self.assertEquals(i['id'],'623')
- self.assertEquals(i['name'],'Scottrade, Inc.')
+ self.assertEqual(i['id'],'623')
+ self.assertEqual(i['name'],'Scottrade, Inc.')
i['id'] = '123'
- self.assertEquals(i['id'],'123')
+ self.assertEqual(i['id'],'123')
def testBadParse(self):
- xml = testfile('badxml_bank.xml').read()
+ with testfile('badxml_bank.xml') as f:
+ xml = f.read()
try:
l = Institution(xml)
self.assertFalse(0)
@@ -61,32 +65,36 @@ class InstitutionListTestCase(unittest.TestCase):
def testFromFile(self):
l = InstitutionList.from_file( testfile_name('search_america.xml') )
- self.assertEquals(len(l),15)
+ self.assertEqual(len(l),15)
def testGoodResult(self):
- xml = testfile('search_america.xml').read()
+ with testfile('search_america.xml') as f:
+ xml = f.read()
l = InstitutionList(xml)
- self.assertEquals(len(l),15)
- self.assertEquals(l.xml,xml)
- self.assertEquals(l[0]['id'],'533')
- self.assertEquals(l[0]['name'],'America First Credit Union')
+ self.assertEqual(len(l),15)
+ self.assertEqual(l.xml,xml)
+ self.assertEqual(l[0]['id'],'533')
+ self.assertEqual(l[0]['name'],'America First Credit Union')
def testResultWithPHPError(self):
- xml = testfile('search_noexist.xml').read()
+ with testfile('search_noexist.xml') as f:
+ xml = f.read()
l = InstitutionList(xml)
- self.assertEquals(len(l),0)
- self.assertEquals(l.xml,xml)
+ self.assertEqual(len(l),0)
+ self.assertEqual(l.xml,xml)
def testIterator(self):
count = 0
- xml = testfile('search_america.xml').read()
+ with testfile('search_america.xml') as f:
+ xml = f.read()
l = InstitutionList(xml)
for i in l:
count += 1
- self.assertEquals(count,15)
+ self.assertEqual(count,15)
def testBadXML(self):
- xml = testfile('badxml_search.xml').read()
+ with testfile('badxml_search.xml') as f:
+ xml = f.read()
try:
l = InstitutionList(xml)
self.assertFalse(0)
@@ -102,7 +110,7 @@ def testfile_name(filename):
return path
def testfile(filename):
- return file(testfile_name(filename))
+ return open(testfile_name(filename))
if __name__ == '__main__':
diff --git a/setup.py b/setup.py
index ec8b736..ab687e7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name='ofxhome',
- version="0.3.2",
+ version="0.3.3",
description="ofxhome.com financial institution lookup REST client",
long_description=open("./README", "r").read(),
classifiers=[