Пример #1
0
  def get(self, id):

    user = User.query.filter_by(id=id).first()

    if user:
      return jsonify(user_schema.dump(user).data)

    else:
      return error_serializers('Unknown user!', 400), 400
Пример #2
0
  def post(self):

    args = parser.parse_args()

    if not args['firstName'] or not args['lastName'] or not args['linkedinId']:
      return error_serializers('Params Error!', 400), 400

    # Add user or update user in our database
    user = add_or_update_user(args)

    # Analysis user tags
    analysis_tags(user.id, args)

    if user:
      return jsonify(user_schema.dump(user).data)

    else:
      return error_serializers('Error token!', 401), 401