Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask
- from requests import *
- list_of_names=[]
- app = Flask(__name__)
- @app.route("/name/add", methods=["POST"])
- def name_add():
- name = request.args.get('name')
- list_of_names.append(name)
- @app.route("/names", methods=["GET"])
- def names():
- return list_of_names
- @app.route("/name/remove", methods=["DELETE"])
- def name_remove():
- name = request.args.get('name')
- list_of_names.remove(name)
- if __name__ == "__main__":
- app.run()
- requests.post('127.0.0.1:5000/name/add', params = {"name":"andy"})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement