• <tfoot id='Z3Q83'></tfoot>
    <i id='Z3Q83'><tr id='Z3Q83'><dt id='Z3Q83'><q id='Z3Q83'><span id='Z3Q83'><b id='Z3Q83'><form id='Z3Q83'><ins id='Z3Q83'></ins><ul id='Z3Q83'></ul><sub id='Z3Q83'></sub></form><legend id='Z3Q83'></legend><bdo id='Z3Q83'><pre id='Z3Q83'><center id='Z3Q83'></center></pre></bdo></b><th id='Z3Q83'></th></span></q></dt></tr></i><div id='Z3Q83'><tfoot id='Z3Q83'></tfoot><dl id='Z3Q83'><fieldset id='Z3Q83'></fieldset></dl></div>
  • <small id='Z3Q83'></small><noframes id='Z3Q83'>

    <legend id='Z3Q83'><style id='Z3Q83'><dir id='Z3Q83'><q id='Z3Q83'></q></dir></style></legend>

      <bdo id='Z3Q83'></bdo><ul id='Z3Q83'></ul>

        如何使用 Python 自动登录 gmail atom 提要?

        How to auto log into gmail atom feed with Python?(如何使用 Python 自动登录 gmail atom 提要?)

        <small id='uaDxK'></small><noframes id='uaDxK'>

          <tbody id='uaDxK'></tbody>
        <i id='uaDxK'><tr id='uaDxK'><dt id='uaDxK'><q id='uaDxK'><span id='uaDxK'><b id='uaDxK'><form id='uaDxK'><ins id='uaDxK'></ins><ul id='uaDxK'></ul><sub id='uaDxK'></sub></form><legend id='uaDxK'></legend><bdo id='uaDxK'><pre id='uaDxK'><center id='uaDxK'></center></pre></bdo></b><th id='uaDxK'></th></span></q></dt></tr></i><div id='uaDxK'><tfoot id='uaDxK'></tfoot><dl id='uaDxK'><fieldset id='uaDxK'></fieldset></dl></div>

            <bdo id='uaDxK'></bdo><ul id='uaDxK'></ul>
              <legend id='uaDxK'><style id='uaDxK'><dir id='uaDxK'><q id='uaDxK'></q></dir></style></legend>
                • <tfoot id='uaDxK'></tfoot>

                  本文介绍了如何使用 Python 自动登录 gmail atom 提要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Gmail has this sweet thing going on to get an atom feed:

                  def gmail_url(user, pwd):
                      return "https://"+str(user)+":"+str(pwd)+"@gmail.google.com/gmail/feed/atom"
                  

                  Now when you do this in a browser, it authenticates and forwards you. But in Python, at least what I'm trying, isn't working right.

                  url = gmail_url(settings.USER, settings.PASS)
                  print url
                  opener = urllib.FancyURLopener()
                  f = opener.open(url)
                  print f.read()
                  

                  Instead of forwarding correctly, it's doing this:

                  >>> 
                  https://user:pass@gmail.google.com/gmail/feed/atom
                  Enter username for New mail feed at mail.google.com: 
                  

                  This is BAD! I shouldn't have to type in the username and password again!! How can I make it just auto-forward in python as it does in my web browser, so I can get the feed contents without all the BS?

                  解决方案

                  You can use the HTTPBasicAuthHandler, I tried the following and it worked:

                  import urllib2
                  
                  def get_unread_msgs(user, passwd):
                      auth_handler = urllib2.HTTPBasicAuthHandler()
                      auth_handler.add_password(
                          realm='New mail feed',
                          uri='https://mail.google.com',
                          user='%s@gmail.com' % user,
                          passwd=passwd
                      )
                      opener = urllib2.build_opener(auth_handler)
                      urllib2.install_opener(opener)
                      feed = urllib2.urlopen('https://mail.google.com/mail/feed/atom')
                      return feed.read()
                  

                  这篇关于如何使用 Python 自动登录 gmail atom 提要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                  Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)

                    <tbody id='S4YdB'></tbody>
                      • <bdo id='S4YdB'></bdo><ul id='S4YdB'></ul>
                        • <i id='S4YdB'><tr id='S4YdB'><dt id='S4YdB'><q id='S4YdB'><span id='S4YdB'><b id='S4YdB'><form id='S4YdB'><ins id='S4YdB'></ins><ul id='S4YdB'></ul><sub id='S4YdB'></sub></form><legend id='S4YdB'></legend><bdo id='S4YdB'><pre id='S4YdB'><center id='S4YdB'></center></pre></bdo></b><th id='S4YdB'></th></span></q></dt></tr></i><div id='S4YdB'><tfoot id='S4YdB'></tfoot><dl id='S4YdB'><fieldset id='S4YdB'></fieldset></dl></div>
                          <legend id='S4YdB'><style id='S4YdB'><dir id='S4YdB'><q id='S4YdB'></q></dir></style></legend>

                          <small id='S4YdB'></small><noframes id='S4YdB'>

                          <tfoot id='S4YdB'></tfoot>