我正在尝试创建受密码保护的服务器,但是当我输入密码时,输出不允许我输入密码。所有其他输入工作只是
getpass
不允许我输入输入。请帮忙
import smtplib, json_store_client, getpass, hashlib, datetime, sys
from termcolor import colored
from time import sleep, ctime
with smtplib.SMTP('smtp.gmail.com',587) as smtp:
smtp.ehlo() #starts email procedure
smtp.starttls() #encrypts
smtp.ehlo() #starts the email procedure again
pw=getpass.getpass(colored("Enter password:\n","green"))
global attemptpw
attemptpw = 0
try:
smtp.login("********@gmail.com",pw)
#**** is my email, I just don’t want to show it
x=chat("[MOD] {} ".format(opt2),True
except:
print(colored("Invalid Admin password","red"))
sleep(1)
else:
print("password entered:",pw)
对于我正在使用的代码:
repl.it
编辑: 我的代码在这里: repl.it/codingandmemes