Как связать html с Python?
У меня есть HTML код, который запускается как веб приложение на aiohttp(python). Как обратиться к данным, которые вводит пользователь? То есть мне необходимо интегрировать введенные данные в мой скрипт на языке Python, как это сделать?
const sendMessage = () => {
alert('Please wait for the scanning!');
}
html {
font-family: Verdana, "sans-serif";
}
body {
min-height: 100vh;
background: black no-repeat;
}
h1 {
text-align: center;
color: white;
text-shadow: 0 3px 5px rgba(150, 150, 150, 0.8);
}
#root {
display: flex;
flex-direction: column;
align-items: center;
}
#messages {
width: 70%;
}
.message {
background-color: white;
width: 100%;
padding: 20px;
border-radius: 10px;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
transition: 0.3s;
-webkit-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
margin-bottom: 10px;
}
.message:hover {
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
transition: 0.3s;
-webkit-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
}
.message__created {
font-size: 12px;
color: darkgrey;
text-align: right;
}
.message__text {
font-size: 20px;
color: black;
margin-top: 5px;
}
.message__ratings {
display: flex;
justify-content: space-between;
font-size: 16px;
font-weight: 400;
margin-top: 5px;
}
.form {
width: 70%;
margin-bottom: 20px;
display: flex;
flex-direction: column;
gap: 20px;
}
.form__button {
text-align: center;
margin-top: 150px;
background-color: white;
cursor: pointer;
}
.form__input, .form__button {
box-sizing: border-box;
width: 100%;
font-size: 18px;
outline: none;
border: none;
padding: 20px;
border-radius: 15px;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
transition: 0.3s;
-webkit-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 5px 5px 0px rgba(0, 0, 0, 0.1);
}
.form__input:focus, .form__button:hover {
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
transition: 0.3s;
-webkit-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.5);
}
<div>
<h1>Port Scanner</h1>
<div id="root">
<div class="form">
<input id="message_text" class="form__input" type="text"
placeholder="IP adress"/>
<input id="message_text1" class="form__input" type="text"
placeholder="Range of ports"/>
<div class="form__button" onclick="sendMessage()">Scan</div>
</div>
<div id="messages">
</div>
</div>
</div>
Ответы (1 шт):
Автор решения: Archibaldik
→ Ссылка
Скачай pyscript, на официальном сайте вам все покажут как его привязать к html