1 Reply Latest reply on May 29, 2015 9:54 AM by DiegoV_Intel

    Accessing GMail  with Python on the Edison.


      So well i found out about this library while searching for a way to read and organize my emails (from gmail). It looks pretty straightforward. Uptil now I have just installed the library (you know, running "python setup.py install" in the gmail directory). But I'm not sure if I'm getting the correct results. Here is my code.


      from gmail import Gmail



      g = Gmail()

      g.login("ivweitvb@gmail.com", "voierugvhnoeiv")

      # play with your gmail...

      t = g.logged_in

      print t








      The onlly output is "True". But i want to see my mails, read the body, see who is the sender etc etc, just like you'd do on a phone. S what should i DO?

        • 1. Re: Accessing GMail  with Python on the Edison.



          I've checked the library here: charlierguo/gmail · GitHub. Did you check this site as well? According to the description in there, in order to get all the messages in your inbox you have to use:



          In your code, you are printing the value of "t" which it should be True because you are logged in. The description explains that you can use g.logged_in to check if you are logged in (charlierguo/gmail · GitHub). It will return True is you are. So that is the True value that you get in your print statement.


          You have print the value returned by g.inbox().mail(), so you could modify a little bit your code by adding the following lines:

          messages = g.inbox().mail()
          print messages


          It should print the output of g.inbox().mail() which according to the description, it should be the messages in your inbox (charlierguo/gmail · GitHub).