def addPlayer(): player = request.data('p1') team = request.data('team') tourney_id = request.data('tournamentID') tournament.addPlayer(tourney_id, team, player) return "Succesfull", 303
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)
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
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
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)
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)
def get_car(): #получаем данные из запроса im = request.data() #обрабатываем картинку runNeoro(im) data = img2data(im) # Возращаем результат ввиде json return json.dump(data)
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")
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)
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)
def box_value(): ''' read vaule from user and send it to control-server''' print(request.data()) return "ok"