I have this form in index.html.

<form action="/{{chatname}}" method="post"> <p><input type=text name=username> Имя пользователя <p><input type=text name=message_text> Текст сообщения <p><input type=button value=post> </form> 

And such a code is a handler method

 def handler_post_message(request): chatname = request.match_info.get('chatname') # user = request.match_info.get('username') text = "Hello, " + chatname s = await loop.create_task(Chat.save_message(chatname, username, message_text)) print(s) return aiohttp_jinja2.render_template('index.html', request, {'name': chatname, 'messages': Chat.messages}) 

I want to get the username and message_text in this function handler from the jinja form. In flask it can be done by setting request.form ['username']. But I can't find a similar working solution for aiohttp

    1 answer 1

    I don't even know what you were looking for. The relevant section of the documentation .

     data = await request.post() login = data['username'] password = data['message_text'] 

    By the way, attribute values ​​in HTML should be framed with quotes.