()
return jsonify(success=True)
Endpoint to create anew user
Endpoint to create anew user
Endpoint to create anew user
def create_user():
    """Endpoint to create anew user"""
    try:
        username = request.json['username']
        password = request.json['password']
        ns = request.json['ns']
        if ns != NETWORK_SECRET:
            return 'Wrong secret', 402
    except KeyError as e:
        return jsonify(success=False, message="%s not sent in the request" % e.args), 400

    u = User(username, password)
    db.session.add(u)
    try:
        db.session.commit()
    except IntegrityError as e:
        return jsonify(success=False, message="This username already exists"), 400

    return jsonify(success=True)
def create_user ( ) : try : username = request . json [ 'username' ] password = request . json [ 'password' ] ns = request . json [ 'ns' ] if ns != NETWORK_SECRET : return 'Wrong secret' , 402 except KeyError as e : return jsonify ( success = False , message = "%s not sent in the request" % e . args ) , 400 u = User ( username , password ) db . session . add ( u ) try : db . session . commit ( ) except IntegrityError as e : return jsonify ( success = False , message = "This username already exists" ) , 400 return jsonify ( success = True )