def signup(): success, error = False, '' scan = User.scan(username=request.json['username']) if scan['Count'] == 0: User.new(request.json['username'], request.json['password']) else: error = 'Username taken' return {'success': success, 'error': error}
def users(): if request.method == 'GET': if request.args: return User.scan(username=request.args['username']) return User.scan() if request.method == 'POST': return User.new(request.json['username'], request.json['password'])