プロジェクトの一環として、Python に HTML で送信されたフォームを受信させようとしています。変数を取得したら、コンソールに「True」または「False」を出力するためにpythonが必要です。これがフォームの現在の HTML コードです。
...
<form name = "input" action = "CheckLogin.py" method = "get">
<!-- This is the form. Here the user submits their username and password.
The words before the colon are the words that appear on the user's screen -->
Username: <input type = "text" name = "htmlUser">
<br>
Password: <input type = "password" name = "htmlPassword">
<input type = "submit" value = "Submit">
<br>
</form>
...
ユーザー名とパスワードを送信してもらったら、このデータを使用して電子メール サーバーにログインできるかどうかを確認します (この場合は Google を使用しましたが、Microsoft Server 2003 はうまく動作しません)。これが私の Python です。そうするための3つのスクリプト:
def login(username, password):
import poplib
try:
server = poplib.POP3_SSL('pop.gmail.com', 995)#Weird bug here. When I use the exeter server, I am informed that the SSL number is incorrect. How do I fix?
server.user(username)
server.pass_(password)
print ("True")
except:
print("False")
login (username, password)
私の質問は、どのように Python にHTML Web フォームから変数username
と変数を取得させることができますか?password