在Python中自动执行Gmail登录 [英] Automating Gmail login in Python

查看:236
本文介绍了在Python中自动执行Gmail登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个可以登录Gmail的Python程序.

I am writing a Python program that can login Gmail.

该程序的目的是检查用户名/密码组合是否存在并且正确.

The purpose of this program is to check whether the username/password combination exists and is correct.

由于该程序用于测试用户名/密码组合的存在,因此无需知道Gmail中的任何邮件内容.

Since this program is to test the the username/password combination existence, it's no need to know any mail contents in Gmail.

该程序的输入是用户名密码.

该程序的输出为

成功登录

登录失败

登录失败可能是:

  1. 现有的用户名+密码错误
  2. 不存在的用户名

我的想法是先登录Gmail.之后,如果登录失败,则gmail网页将在登录网页上显示特定消息.我可以解析网页内容,并检查网页内容是否包含该特定消息.

My idea is to login Gmail first. Afterward, when login failure, the gmail webpage will show particular message on the login webpage. I can parse the webpage content and check whether it has that particular message.

但是,我仍然不知道如何使用Python登录Gmail.请让我知道可以使用哪个模块,或者给我写一小段示例代码.

However, I still have no idea how to login Gmail in Python. Please let me know which module can be used or write me a small piece of sample code.

推荐答案

这种事情就像 prohibited 一样,这就是为什么要创建OAuth或OpenID之类的原因.这类事情使用户无需输入用户名密码即可登录.所以要小心.

This kind of things are like prohibited, that's why things like OAuth or OpenID are created. This kind of things permit the user to login without entering username and password. So be careful.

这篇关于在Python中自动执行Gmail登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆