Skip to content

Commit fb739cd

Browse files
authored
add documenttype arg to get_series (#20)
1 parent 6ed68a8 commit fb739cd

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

regcensus/api.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ def get_reading_time(*args, **kwargs):
188188
'documentationUrl', 'footNote']]
189189

190190

191-
def get_series(jurisdictionID=None, verbose=0):
191+
def get_series(jurisdictionID=None, documentType=None, verbose=0):
192192
"""
193193
Get series and date metadata for all or one specific jurisdiction
194194
195195
Args: jurisdictionID (optional): ID for the jurisdiction
196196
197197
Returns: pandas dataframe with the metadata
198198
"""
199-
url_call = series_url(jurisdictionID)
199+
url_call = series_url(jurisdictionID, documentType)
200200
if verbose:
201201
print(f'API call: {url_call}')
202202
return clean_columns(json_normalize(requests.get(url_call).json()))
@@ -391,11 +391,17 @@ def list_industries(keyword=None, codeLevel=3, standard='NAICS', onlyID=False):
391391
i["industryName"]: i["industryID"] for i in json}.items()))
392392

393393

394-
def series_url(jurisdictionID):
394+
def series_url(jurisdictionID, documentType=None):
395395
"""Gets url call for series endpoint."""
396396
url_call = URL + '/series'
397-
if jurisdictionID:
397+
if jurisdictionID and documentType:
398+
url_call += (
399+
f'?jurisdiction={jurisdictionID}&'
400+
f'documentType={documentType}')
401+
elif jurisdictionID:
398402
url_call += f'?jurisdiction={jurisdictionID}'
403+
elif documentType:
404+
url_call += f'?documentType={documentType}'
399405
return url_call
400406

401407

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.3.0',
7+
version='0.3.1',
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)