Create a RESTfull API using Python and Flask (Part 1)

Image for post
Image for post

RESTfull API ??

PYTHON

FLASK

Let’s Go

Pre-requisites

python --version
pip --version
pip install flask

Why do we need an API?

Our Project

mkdir myfirst_api
cd myfirst_api
mkdir api
import flask

app = flask.Flask(__name__)
app.config["DEBUG"] = True


@app.route('/', methods=['GET'])
def home():
return '''<h1>Welcome to New Project</h1>
<p>A prototype API for distant reading of Music Albums and Playlists.</p>'''app.run()
cd myfirst_api/api
python api.py
Image for post
Image for post
Image for post
Image for post

Software Engineer at Pearson Lanka || Former Associate Software Engineer at hSenid Software International

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store