python - 在python中使用用户名和密码的Gmail登录API
问题描述
我有username
gmailpassword
帐户,我需要API才能从我的 python 代码自动登录到 gmail。
我试过使用smtplib
import smtplib
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.starttls()
username="test@gmail.com"
password="test"
server.login(username, password)
server.quit()
我收到smtplib.SMTPAuthenticationError
错误
解决方案
转到Google 帐户安全设置并登录到您的帐户。
您需要向下滚动并打开“允许不太安全的应用程序”选项。
推荐阅读
- ruby-on-rails - 由于字段不存在而创建不保存记录
- youtube-api - 活动“列表”端点似乎没有返回所有活动
- django - 带有apache的django应用程序中的Weasyprint问题
- reactjs - 广告展示的 React 渲染问题
- r - 在 R 中拟合模型时排除 ID 字段
- javascript - 无效的协议:未定义 - POST 请求上的 NodeJS 错误 -
- android - Android 通知图标无法关闭
- jquery - 如何使用 jQuery Ajax 显示 JSON 数据?
- python - Python 多处理池类不起作用
- kotlin - 制作我自己的按钮类