Skip to content

Commit 9461329

Browse files
committed
require documentType in get_periods
1 parent 8a772f7 commit 9461329

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

regcensus/api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def get_values(series, jurisdiction, date, filtered=True, summary=True,
102102
# and function returns empty.
103103
else:
104104
print("Valid date is required.")
105-
pp.pprint(get_periods(jurisdiction))
105+
pp.pprint(get_periods(jurisdiction, documentType=3))
106106
return
107107

108108
if dateIsRange:
@@ -194,12 +194,14 @@ def get_jurisdictions(jurisdictionID='', verbose=0):
194194
return clean_columns(json_normalize(requests.get(url_call).json()))
195195

196196

197-
def get_periods(jurisdictionID, seriesID='', documentType=3, verbose=0):
197+
def get_periods(jurisdictionID, documentType, seriesID='', verbose=0):
198198
"""
199199
Get dates available for all or one specific series for a jurisdiction
200200
201201
Args:
202202
jurisdictionID: ID for the jurisdiction
203+
documentType: document type (regulations, statutes, etc.),
204+
see list_document_types()
203205
seriesID (optional): ID for the series
204206
205207
Returns: pandas dataframe with the dates

tests/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ def test_get_jurisdictions():
3636

3737

3838
def test_get_periods():
39-
results = rc.get_periods(38, verbose=1)
39+
results = rc.get_periods(38, documentType=3, verbose=1)
4040
assert order_results(results, 'recordsAvailable', descending=True) == [
4141
30696278, 30696278, 30696278, 30696278, 30696278,
4242
30696278, 30696278, 30696278, 30696278, 30696278
4343
]
4444

4545

4646
def test_get_periods_one_series():
47-
results = rc.get_periods(38, seriesID=19, verbose=1)
48-
assert order_results(results, 'recordsAvailable') == [16796, 16796]
47+
results = rc.get_periods(20, documentType=3, seriesID=19, verbose=1)
48+
assert order_results(results, 'recordsAvailable') == [13]
4949

5050

5151
def test_get_industries():

0 commit comments

Comments
 (0)