Пример #1
0
def addPlayer():
    player = request.data('p1')
    team = request.data('team')
    tourney_id = request.data('tournamentID')

    tournament.addPlayer(tourney_id, team, player)
    return "Succesfull", 303
Пример #2
0
def make_prediction_test():
    if request.method == 'POST':
        X = request.data('label1')
        y = request.data('data1')
        x_test = X
        y_test = y

        predicted_svm = loaded_model.predict(x_test)
        lab1 = str(np.mean(predicted_svm == y_test))
        return render_template('index.html', label11=lab1)
Пример #3
0
def addTeam():
    p1 = request.data('p1')
    p2 = request.data('p2')
    p3 = request.data('p3')  # if it exists!!
    id = ""
    name = ""
    tourney_id = request.data('tournamentID')

    tournament.addTeam(tourney_id, id, name, p1, p2, p3)
    return "Succesfull", 303
Пример #4
0
    def put(self, id):
        json_data = request.get_json(data)
        if not json:
            response = jsonify({'error': 'Invalid Input'})
            response.status_code = 400
            return response

        project = Project.query.get_or_404(id)
        project.name = request.data('name')
        project.description = request.data('description')
        db.session.commit()

        response = jsonify({'data': project_schema.dump(project).data})
        response.status_code = 200
        return response
Пример #5
0
def webhook():
    if request.headers.get('contetnt-type') == 'application/json':
        json_string = request.data().decode('utf-8')
        update = Update.de_json(json_string)
        bot.process_new_update([update])
    else:
        abort(403)
Пример #6
0
def similar():
    data = json.loads(request.data())
    try:
        simi = WORD_VEC.most_similar(data['query'])
        return json.dumps(simi, ensure_ascii=False)
    except:
        return '{} not in dic'.format(data)
Пример #7
0
def get_car():
    #получаем данные из запроса
    im = request.data()
    #обрабатываем картинку
    runNeoro(im)
    data = img2data(im)
    # Возращаем результат ввиде json
    return json.dump(data)
Пример #8
0
def Chatter():
    while True:
        API_endpoint = ''
        message = request.data()
        CB = Chatbot()
        reply = CB.chat(message['data'])
        requests.post(API_endpoint, data={'reply': reply})
        if CB.exit_code:
		break
def count_in_background():
    data = request.data()
    number = data["number"]

    job = q(counter, number)
    job_data = {"job_id": f"{job.id}"}

    return Response(response=json.dumps(job_data),
                    status=200,
                    mimetype="application/json")
Пример #10
0
def edit_garbage_can(current_user):
    """route: /garbage/edit
                POST: Delete a garbage can for a user
                params:
                    id: String
        """
    can_id = str(request.data('id', ''))
    if len(can_id) > 0:
        GarbageCan.delete_by_id(can_id)
        return common.to_json({}, "Can successfully deleted", 200)
    else:
        return common.to_json({}, "No such can", 400)
Пример #11
0
def wmd():
    data = json.loads(request.data())
    text1 = jieba.lcut(data['text1'])
    text2 = jieba.lcut(data['text2'])
    distance = WORD_VEC.wmdistance(text1, text2)
    return json.dumps({'distance': distance}, ensure_ascii=False)
Пример #12
0
def box_value():
    ''' read vaule from user and send it to control-server'''
    print(request.data())
    return "ok"