Skip to content

Commit 131abaa

Browse files
authored
0.4.2
* allow multiple dates in get_documents()
1 parent 5852a45 commit 131abaa

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

regcensus/api.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def get_documents(documentID=None, jurisdictionID=None, date=None,
269269
Args:
270270
documentID: ID of the specific document
271271
jurisdictionID: ID for the jurisdiction
272-
date: Year of the documents
272+
date: Year(s) of the documents
273273
documentType (optional): ID for type of document
274274
275275
Returns: pandas dataframe with the metadata
@@ -282,7 +282,14 @@ def get_documents(documentID=None, jurisdictionID=None, date=None,
282282
else:
283283
print('Must include either "jurisdictionID and date" or "documentID."')
284284
return
285-
url_call += f'&date={date}'
285+
if type(date) == list:
286+
url_call += f'&date={",".join(str(i) for i in date)}'
287+
if len(date) == 2:
288+
url_call += '&dateIsRange=true'
289+
else:
290+
url_call += '&dateIsRange=false'
291+
else:
292+
url_call += f'&date={date}'
286293
if verbose:
287294
print(f'API call: {url_call}')
288295
return clean_columns(json_normalize(requests.get(url_call).json()))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='regcensus',
7-
version='0.4.1',
7+
version='0.4.2',
88
description='Python package for accessing data from the QuantGov API',
99
url='https://github.com/QuantGov/regcensus-api-python',
1010
author='QuantGov',

0 commit comments

Comments
 (0)