I love data, but it does no good sitting on a machine collecting lint.
So I create APIs that we can get to it and do fun things.
Here is a very basic API to a Student database, created using Flask.
Yes, there are "better options" than Flask, but who cares?
It's easy and fast, just like me.
-
I'm running Python 3.11.3
-
You might need to:
pip3 install Flask
- I've included the SQLite database, but also the SQL (STUDENTS.sql) you can use to create the database on your own if you'd like.
From the command line:
python3 student-api.py
- Go to home:
http://127.0.0.1:8888/
- See all students in the database:
http://127.0.0.1:8888/getStudents
- Get student by ID:
http://127.0.0.1:8888/getStudentById/2