diff --git a/ChangeLog b/ChangeLog index ab29b414ebd8fbdf0946c5b81d98d7ce3d2c719b..59a9125d4355aa13b0b0e98c08740b64fa0c27ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-05-14 Paul Tagliamonte <paultag@sunlightfoundation.com> + +* sunlight/services/openstates.py: + - Added a new method - "openstates.bill", to get single bills by bill ID + - Fixed the exception that gets raised + when running "openstates.bill(None)" from something cryptic to something + a bit more explicit. +* Bump release to 1.1.3 + 2012-04-12 Paul Tagliamonte <paultag@sunlightfoundation.com> * sunlight/services/capitolwords.py: Fixed a URL Encoding issue that was diff --git a/PKG-INFO b/PKG-INFO index d2ceb9ab7c4dbaeb0b3cea5fbed6395134e017ee..9272b45312a4899428bf1d4209c20de7fb27c22f 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: sunlight -Version: 1.1.2 +Version: 1.1.3 Summary: Unified Sunlight API bindings Home-page: https://github.com/sunlightlabs/python-sunlight Author: Paul Tagliamonte diff --git a/debian/changelog b/debian/changelog index 4523b81f1f307e9047ae81e109ddf6ce1e7e0dce..9c2bf90d5374412b8b6ac80385298914c24ddd6b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-sunlight (1.1.3-1) unstable; urgency=low + + * New upstream release. Adds a new method to the OpenStates object, and + adds a more helpful exception when you attempt to pass "None" into an + OpenStates method. + + -- Paul Tagliamonte <paultag@ubuntu.com> Tue, 15 May 2012 23:04:51 -0400 + python-sunlight (1.1.2-1) unstable; urgency=low * New upstream release. Solves a URL encoding issue that was present in both diff --git a/sunlight.egg-info/PKG-INFO b/sunlight.egg-info/PKG-INFO index d2ceb9ab7c4dbaeb0b3cea5fbed6395134e017ee..9272b45312a4899428bf1d4209c20de7fb27c22f 100644 --- a/sunlight.egg-info/PKG-INFO +++ b/sunlight.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: sunlight -Version: 1.1.2 +Version: 1.1.3 Summary: Unified Sunlight API bindings Home-page: https://github.com/sunlightlabs/python-sunlight Author: Paul Tagliamonte diff --git a/sunlight/__init__.py b/sunlight/__init__.py index e76635a57d9dd1928b7cacc0851166c821426ec6..df4d45ce7891298fae3a3fcd1331113b85b1fca1 100644 --- a/sunlight/__init__.py +++ b/sunlight/__init__.py @@ -11,7 +11,7 @@ fight with finding the right module to use. """ __appname__ = "sunlight" -__version__ = "1.1.2" +__version__ = "1.1.3" import sunlight.services.openstates import sunlight.services.capitolwords diff --git a/sunlight/errors.py b/sunlight/errors.py index 2c2ffcbe39e2d2060d0b6523297198f73f0f4fcb..1a60e7070f0c44ac60e605013ef7f0fe404f0e9b 100644 --- a/sunlight/errors.py +++ b/sunlight/errors.py @@ -34,7 +34,7 @@ class SunlightException(Exception): class BadRequestException(SunlightException): """ This gets thrown when the underlying url request has recieved an abnormal - response code. + response code, or the program has issued a request that can not be filled. """ pass diff --git a/sunlight/services/openstates.py b/sunlight/services/openstates.py index d87b10c8ed9deac9c98e2f915222e56078a3b2a4..80ca9148f228eafb9e54e6ef95ef45b1ae351f63 100644 --- a/sunlight/services/openstates.py +++ b/sunlight/services/openstates.py @@ -2,6 +2,7 @@ # of the LICENSE file. import sunlight.service +from sunlight.errors import BadRequestException import json module_name = "openstates" @@ -43,6 +44,15 @@ class openstates(sunlight.service.Service): """ return self.get(["bills"], **kwargs) + def bill(self, bill_id, **kwargs): + """ + Get full information on a single bill from the Open States API given + the OpenStates Bill ID (such as TNB00004685) + + `Bill API docs <http://openstates.org/api/bills/>`_. + """ + return self.get(["bills", bill_id], **kwargs) + def bill_detail(self, state, session, bill_id, chamber=None): """ Get full information on a single bill from the Open States API given @@ -168,6 +178,11 @@ class openstates(sunlight.service.Service): # API impl methods def _get_url(self, objs, apikey, **kwargs): + # Gate for any None's in the query. This is usually a problem. + if None in objs: + raise BadRequestException("`None' passed to the URL encoder (%s)" % + (str(objs))) + # join pieces by slashes and add a trailing slash object_path = "/".join(objs) object_path += "/"