Ejemplo n.º 1
0
def add():
	user = request.args.get('user')
	pwd = request.args.get('pwd')
	if not user or not pwd:
		return '<p>need user and pwd</p>' + user.get_html()
	else:
		user.user_dict[user] = pwd
		user.update_file()
	return user.get_html()
Ejemplo n.º 2
0
def delete():
	user = request.args.get('user')
	if user in user.user_dict:
		user.user_dict.pop(user)
		user.update_file()
		return user.get_html
	else:
		return '<p>user not exist</p>' + user.get_html()
Ejemplo n.º 3
0
def index():
	return user.get_html()
Ejemplo n.º 4
0
from flask import Flask,request
import user
app = Flask(__name__)
user.get_html()
@app.route('/')
def index():
	return user.get_html()

@app.route('/add')
def add():
	user = request.args.get('user')
	pwd = request.args.get('pwd')
	if not user or not pwd:
		return '<p>need user and pwd</p>' + user.get_html()
	else:
		user.user_dict[user] = pwd
		user.update_file()
	return user.get_html()
@app.route('/delete')
def delete():
	user = request.args.get('user')
	if user in user.user_dict:
		user.user_dict.pop(user)
		user.update_file()
		return user.get_html
	else:
		return '<p>user not exist</p>' + user.get_html()
if __name__=='__main__':
	app.run(host = '0.0.0.0',port = 1234,debug=True)