所以我正在尝试将数据从html表单发送到我的python flask框架。 这是我正在使用的html代码的例子
<form method=post action=/test>
<input name=Name value=Austin type=hidden><input type=submit value="Add Notification">
这是我正在使用的python烧瓶
@app.route('/test', methods=('GET', 'POST')
def test_page():
v = request.values.get('Name')
return v
我尝试了很多不同的请求方法,似乎无法使它工作,我得到405错误。我不熟悉烧瓶网站开发或使用帖子请求。如果有人能指出我正确的方向,那就太棒了!
答案 0 :(得分:3)
您{{}} {{}} {{}}} POST
app.route
GET
app.route('/test')
app.route('/test', methods=('GET', 'POST'))
405
将request.values.get['Name']
更改为request.values.get('Name')
,您就可以访问自己的终端。
您textField.setBackground(null);
textField.setBorder(null);
的回复是default。
(不相关的问题,class Example
{
/**
* here i want to have exactly the same phpdoc,
* like what i created for getMeSomethingFromTheShelf() in the same class
*/
public function getMeSomething($id, $option = [])
{
return $this->getMeSomethingFromTheShelf($id, $option);
}
/**
* Some description
* and some more detail about how the $option value will be used
*
* @param int $id
* @param array $option and here some we have some sample
* @return string
*/
public function getMeSomethingFromTheShelf($id, $option = [])
{
return 'here you go :)';
}
}
class AnotherClass
{
/**
* here also i want to have exactly the same phpdoc,
* like what i created for Example::getMeSomethingFromTheShelf() in the Example class
*/
public function fetchSomething($id, $option = [])
{
return (new Example)->getMeSomething($id, $option = []);
}
}
应为{{1}}。)