Skip to content

Commit e76768a

Browse files
committed
documenttype option in get_documents
1 parent c5bea0a commit e76768a

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

regcensus/api.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_values(series, jurisdiction, date, filtered=True, summary=True,
2222
date: Year(s) of data
2323
summary (optional): Return summary instead of document level data
2424
filtered (optional): Exclude poorly-performing industry results
25-
documentType (optional): Type of document
25+
documentType (optional): ID for type of document
2626
agency (optional): Agency ID
2727
industry (optional): Industry code using the jurisdiction-specific
2828
coding system (use 'all' for all industries)
@@ -216,10 +216,21 @@ def get_industries(jurisdictionID):
216216
return clean_columns(output)
217217

218218

219-
def get_documents(jurisdictionID):
219+
def get_documents(jurisdictionID, documentType=3):
220+
"""
221+
Get metadata for documents available in a specific jurisdiction, optional
222+
filtering by document type (see list_document_types() for options)
223+
224+
Args:
225+
jurisdictionID: ID for the jurisdiction
226+
documentType (optional): ID for type of document
227+
228+
Returns: pandas dataframe with the metadata
229+
"""
220230
output = pd.io.json.json_normalize(
221231
requests.get(
222-
URL + f'/documents?jurisdiction={jurisdictionID}&documentType=3'
232+
URL + (f'/documents?jurisdiction={jurisdictionID}&'
233+
f'documentType={documentType}')
223234
).json())
224235
return clean_columns(output)
225236

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.1.2',
7+
version='0.1.3',
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)