Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, request, jsonify
- app = Flask(__name__)
- @app.route('/subscribe', methods=['GET'])
- def add_subscribers():
- email_address = request.args.get('email')
- # add the subscribers to the email list
- try:
- write(email_address)
- return "Okay", 200
- except Exception as e:
- return e, 500
- @app.route('/list', methods=['GET'])
- def show_subscribers():
- try:
- mails = read()
- email_json = {"emails": mails}
- return jsonify(email_json)
- except Exception as e:
- return e, 500
- if __name__ == "__main__":
- app.run(debug=True)
Add Comment
Please, Sign In to add comment