9
9
"""
10
10
11
11
import sunlight .service
12
- from sunlight .service import EntityList
13
- from sunlight .service import EntityDict
12
+ from sunlight .service import EntityDict , EntityList
13
+ from sunlight .pagination import pageable
14
14
import json
15
15
16
16
@@ -51,6 +51,9 @@ class Congress(sunlight.service.Service):
51
51
is the place to look for help on field names and examples.
52
52
"""
53
53
54
+ is_pageable = True
55
+
56
+ @pageable
54
57
def legislators (self , ** kwargs ):
55
58
"""
56
59
Search and filter for members of Congress.
@@ -60,6 +63,7 @@ def legislators(self, **kwargs):
60
63
"""
61
64
return self .get ('legislators' , ** kwargs )
62
65
66
+ @pageable
63
67
def legislator (self , identifier , id_type = LEGISLATOR_ID_TYPES [0 ], ** kwargs ):
64
68
"""
65
69
Retrieve a member of Congress by a unique identifier. Defaults to
@@ -91,7 +95,6 @@ def legislator(self, identifier, id_type=LEGISLATOR_ID_TYPES[0], **kwargs):
91
95
return EntityDict (results [0 ], results ._meta )
92
96
return None
93
97
94
-
95
98
def all_legislators_in_office (self , ** kwargs ):
96
99
"""
97
100
Returns all legislators currently in office (non-paginated response).
@@ -104,6 +107,7 @@ def all_legislators_in_office(self, **kwargs):
104
107
})
105
108
return self .get ('legislators' , ** kwargs )
106
109
110
+ @pageable
107
111
def locate_legislators_by_lat_lon (self , lat , lon , ** kwargs ):
108
112
"""
109
113
Find members of Congress by a latitude and longitude.
@@ -117,6 +121,7 @@ def locate_legislators_by_lat_lon(self, lat, lon, **kwargs):
117
121
})
118
122
return self .get ('legislators/locate' , ** kwargs )
119
123
124
+ @pageable
120
125
def locate_legislators_by_zip (self , zipcode , ** kwargs ):
121
126
"""
122
127
Find members of Congress by zip code.
@@ -129,6 +134,7 @@ def locate_legislators_by_zip(self, zipcode, **kwargs):
129
134
})
130
135
return self .get ('legislators/locate' , ** kwargs )
131
136
137
+ @pageable
132
138
def bills (self , ** kwargs ):
133
139
"""
134
140
Search and filter through bills in Congress.
@@ -138,6 +144,7 @@ def bills(self, **kwargs):
138
144
"""
139
145
return self .get ('bills' , ** kwargs )
140
146
147
+ @pageable
141
148
def bill (self , bill_id , ** kwargs ):
142
149
"""
143
150
Retrieve a bill by bill_id.
@@ -153,6 +160,7 @@ def bill(self, bill_id, **kwargs):
153
160
return EntityDict (results [0 ], results ._meta )
154
161
return None
155
162
163
+ @pageable
156
164
def search_bills (self , query , ** kwargs ):
157
165
"""
158
166
Search the full text of legislation, and other fields.
@@ -165,6 +173,7 @@ def search_bills(self, query, **kwargs):
165
173
})
166
174
return self .get ('bills/search' , ** kwargs )
167
175
176
+ @pageable
168
177
def upcoming_bills (self , ** kwargs ):
169
178
"""
170
179
Search and filter through upcoming bills in the House and Senate.
@@ -177,6 +186,7 @@ def upcoming_bills(self, **kwargs):
177
186
"""
178
187
return self .get ('upcoming_bills' , ** kwargs )
179
188
189
+ @pageable
180
190
def locate_districts_by_lat_lon (self , lat , lon , ** kwargs ):
181
191
"""
182
192
Find congressional districts by a latitude and longitude.
@@ -190,6 +200,7 @@ def locate_districts_by_lat_lon(self, lat, lon, **kwargs):
190
200
})
191
201
return self .get ('/districts/locate' , ** kwargs )
192
202
203
+ @pageable
193
204
def locate_districts_by_zip (self , zipcode , ** kwargs ):
194
205
"""
195
206
Find congressional districts by a latitude and longitude.
@@ -202,6 +213,7 @@ def locate_districts_by_zip(self, zipcode, **kwargs):
202
213
})
203
214
return self .get ('/districts/locate' , ** kwargs )
204
215
216
+ @pageable
205
217
def committees (self , ** kwargs ):
206
218
"""
207
219
Search and filter through committees in the House and Senate.
@@ -211,6 +223,7 @@ def committees(self, **kwargs):
211
223
"""
212
224
return self .get ('committees' , ** kwargs )
213
225
226
+ @pageable
214
227
def amendments (self , ** kwargs ):
215
228
"""
216
229
Search and filter through amendments in Congress.
@@ -220,6 +233,7 @@ def amendments(self, **kwargs):
220
233
"""
221
234
return self .get ('amendments' , ** kwargs )
222
235
236
+ @pageable
223
237
def votes (self , ** kwargs ):
224
238
"""
225
239
Search and filter through votes in Congress.
@@ -229,6 +243,7 @@ def votes(self, **kwargs):
229
243
"""
230
244
return self .get ('votes' , ** kwargs )
231
245
246
+ @pageable
232
247
def floor_updates (self , ** kwargs ):
233
248
"""
234
249
Search and filter through floor updates in the House and Senate.
@@ -238,6 +253,7 @@ def floor_updates(self, **kwargs):
238
253
"""
239
254
return self .get ('floor_updates' , ** kwargs )
240
255
256
+ @pageable
241
257
def hearings (self , ** kwargs ):
242
258
"""
243
259
Search and filter through committee hearings in the House and Senate.
@@ -247,6 +263,7 @@ def hearings(self, **kwargs):
247
263
"""
248
264
return self .get ('hearings' , ** kwargs )
249
265
266
+ @pageable
250
267
def nominations (self , ** kwargs ):
251
268
"""
252
269
Search and filter through presidential nominations in Congress.
0 commit comments