API to help make public data easier to access. Idea started with need for King County, WA COVID-19 data in API format while only having an excel file for source data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
800 B

import flask
from flask import request, jsonify
app = flask.Flask(__name__)
app.config["DEBUG"] = True
# Create some test data
zipcode = [
{'id': 0,
'zipcode': '98121',
'population': '2123223'
},
{'id': 1,
'zipcode': '98122',
'population': '33244'
},
{'id': 2,
'zipcode': '98123',
'population': '2134'
}
]
@app.route('/', methods=['GET'])
def home():
return "<h1>Public API offered by the team at SeattleMatrix.</h1> <p>This \
site is a collection of api's from various public sources collected \
by the team at Seattle Matrix</p>"
# A route to return all of the available entries in our catalog.
@app.route('/v1/kingcounty/covid-19/zipcode/all', methods=['GET'])
def api_all():
return jsonify(zipcode)
app.run()