Skip to content

Commit dcf29e5

Browse files
Merge pull request #3 from QuantGov/dev
Release 0.1.2
2 parents deeade4 + 9c0756b commit dcf29e5

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

regcensus/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'get_documents',
1010
'list_topics',
1111
'list_series',
12+
'list_document_types',
1213
'list_agencies',
1314
'list_jurisdictions',
1415
'list_industries'
@@ -25,6 +26,7 @@
2526
get_documents,
2627
list_topics,
2728
list_series,
29+
list_document_types,
2830
list_agencies,
2931
list_jurisdictions,
3032
list_industries

regcensus/api.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def get_periods(jurisdictionID=''):
195195
if jurisdictionID:
196196
output = pd.io.json.json_normalize(
197197
requests.get(
198-
URL + f'/periods?jurisdictionID={jurisdictionID}').json())
198+
URL + f'/periods?jurisdiction={jurisdictionID}').json())
199199
else:
200200
output = pd.io.json.json_normalize(
201201
requests.get(URL + f'/periods/available').json())
@@ -228,23 +228,33 @@ def list_topics():
228228
"""
229229
Returns: a dictionary containing names of topics and associated IDs
230230
"""
231-
json = requests.get(URL + f'/topics').json()
231+
json = requests.get(URL + f'/topics/').json()
232232
return dict(sorted({t["topicName"]: t["topicID"] for t in json}.items()))
233233

234234

235235
def list_series():
236236
"""
237237
Returns: dictionary containing names of series and associated IDs
238238
"""
239-
json = requests.get(URL + f'/series').json()
239+
json = requests.get(URL + f'/series/').json()
240240
return dict(sorted({s["seriesName"]: s["seriesID"] for s in json}.items()))
241241

242242

243+
def list_document_types():
244+
"""
245+
Returns: a dictionary containing names of documenttypes and associated IDs
246+
"""
247+
json = requests.get(URL + f'/documenttypes/').json()
248+
return dict(sorted({
249+
d["subtypeName"]: d["documentSubtypeID"]
250+
for d in json if d["subtypeName"]}.items()))
251+
252+
243253
def list_agencies():
244254
"""
245255
Returns: dictionary containing names of agencies and associated IDs
246256
"""
247-
json = requests.get(URL + '/agencies').json()
257+
json = requests.get(URL + '/agencies/').json()
248258
return dict(sorted({
249259
a["agencyName"]: a["agencyID"]
250260
for a in json if a["agencyName"]}.items()))
@@ -254,7 +264,7 @@ def list_jurisdictions():
254264
"""
255265
Returns: dictionary containing names of jurisdictions and associated IDs
256266
"""
257-
json = requests.get(URL + f'/jurisdictions').json()
267+
json = requests.get(URL + f'/jurisdictions/').json()
258268
return dict(sorted({
259269
j["jurisdictionName"]: j["jurisdictionID"] for j in json}.items()))
260270

@@ -266,7 +276,7 @@ def list_industries(jurisdictionID):
266276
Returns: dictionary containing names of industries and their NAICS codes
267277
"""
268278
json = requests.get(
269-
URL + f'/industries?jurisdiction={jurisdictionID}').json()
279+
URL + f'/industries?jurisdiction={jurisdictionID}/').json()
270280
return dict(sorted({
271281
i["industryName"]: i["industryCode"] for i in json}.items()))
272282

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.1',
7+
version='0.1.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)