Skip to content
Snippets Groups Projects
Commit 5d9fc935 authored by Paul Tagliamonte's avatar Paul Tagliamonte :fish_cake:
Browse files

Imported Debian patch 1.1.3-1

No related branches found
No related tags found
No related merge requests found
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
......
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
......
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
......
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
......
......@@ -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
......
......@@ -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
......
......@@ -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 += "/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment