TransWikia.com

How to access data from catalog.data.gov using API's?

Open Data Asked by Shishir Kumar on December 2, 2021

I am new to APIs and am having problems in accessing data from catalog.data.gov. I have successfully used the below code to search my dataset of interest, but can’t figure out how I can fetch the data for the collection “Monthly Traffic Volume Trends”. I am interested in getting all the 154 datasets in this collection. Please guide me through this

import urllib3
from urllib.parse import quote
import json
import pprint

# Make the HTTP request.
http = urllib3.PoolManager()
response = http.request('GET','http://catalog.data.gov/api/3/search/dataset?q="monthly_traffic_volume_trends_may_2002"&rows=10')
# Use the json module to load CKAN's response into a dictionary.
response_dict = json.loads(response.data)
# Check the contents of the response.
result = response_dict['results']
pprint.pprint(result)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP