parameters: ()
return_statement: return jsonify(success=True)
docstring: Endpoint to create anew user
docstring_summary: Endpoint to create anew user
docstring_tokens: Endpoint to create anew user
function: 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)
function_tokens: 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 )