By Christian Hasbani and Antoine Chenevier
Student at ESIREM in 4A ILC
Objectif : Create a Flask API for CRUD management of a transaction system
Pull : GitHub action pull
Push : GitHub action push
We have a list of transactions, each transaction is a tuple (P1, P2, t,s,hash), where s is equal to the amount of money transferred from person P1 to person P2 at time t and hash is the key of the tuple.
We have the current date in second since 01-01-2023.
Here are examples of curl commands to access the different routes in app.py
@app.route("/display_list", methods=['GET'])
def getList():curl -X GET http://localhost:5000/display_listFunction to return all of the dictionary
@app.route("/display_list/<Person>", methods=['GET'])
def getListPerson(Person):
...curl -X POST -d "Person=person" http://localhost:5000/display_list/<Person>Function to return all of the dictionary of a person
@app.route("/display_solde/<Person>", methods=['GET'])
def getSolde(Person):
...curl -X GET -d "Person=person" http://localhost:5000/display_solde/<Person>Function to display the solde of a person
@app.route("/add_element/", methods=['POST','GET'])
def addElement():curl -X GET http://loccurl -X POST http://localhost:5000/add_element/ -d "p1=christian&p2=antoine&solde=10"Function to add an element in the dictionary
@app.route("/importeCSV", methods=['GET'])
def importeCSV():
...curl -d "filePath=tab.csv" -X GET http://localhost:5000/importeCSV
Function to import a CSV file
@app.route("/hash_verification", methods=['GET'])
def hash_vefication():
...curl -X GET http://localhost:5000/hash_verificationHash verification
@app.route("/hash_correctionn", methods=['GET'])
def hash_vefication():
...curl -X GET http://localhost:5000/hash_correctionHash correction
We built the docker image using the following command in the terminal
docker build -t flask-app . Using the docker images command
sudo docker run -it -p 5000:5000 -d flask-appThis will lauch our flask application on localhost port 5000
We use docker ps to display running containers
We can see at the end we have the follow result

We have already implemented all the features in the app.py file before releasing
