Skip to content

Instantly share code, notes, and snippets.

@harilee1325
Created August 23, 2019 16:31
Show Gist options
  • Save harilee1325/3d9efd3e7746a1bcfa8a3900073d970a to your computer and use it in GitHub Desktop.
Save harilee1325/3d9efd3e7746a1bcfa8a3900073d970a to your computer and use it in GitHub Desktop.
from flask import Flask, request, jsonify
import json as simplejson
from bson.json_util import dumps
app = Flask(__name__)
@app.route("/")
def hello():
return "Welcome to Python Flask, hello coder!"
@app.route("/login/<string:username>/<string:password>", methods=['GET'])
def login_user(username, password):
try:
return dumps ({ 'success':'yes','username':username, 'password': password})
except Exception as e:
return dumps({'error' : str(e)})
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment