Thread: gmail recipe
View Single Post
Old 09-26-2010, 08:45 AM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by marbs View Post
i am trying to make a gmail recipe. the address is https://mail.google.com/gmail/feed/atom/. i was thinking it ould be a good idea to logon through https://www.google.com/accounts/Logi...ww.google.com/ and then download the feed. it works in a regular browser when i do it. not working in python. any ideas?

Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1285454835(BasicNewsRecipe):
    title          = u'test1'
    __author__            = 'marbs'
    oldest_article = 7
    max_articles_per_feed = 100
    needs_subscription = True
    feeds          = [(u'test', u'https://mail.google.com/gmail/feed/atom/')]

    LOGIN = 'https://www.google.com/accounts/Login?hl=en&continue=http://www.google.com/'

    def get_browser(self):
        br = BasicNewsRecipe.get_browser()
        if self.username is not None and self.password is not None:
            br.open(self.LOGIN)
            br.select_form(id='gaia_loginform')
            br['Email'] = self.username
            br['passwd'] = self.password
            br.submit()
        return br
You can look at the Google Reader recipe to see how authentication works using the Google API. I did the authentication part of that recipe, but nothing else. I played around with trying to do it the way you're doing it, but found that using the API worked better. There's a thread about Google Reader that has some links to Google API docs. Searching should find it.
Starson17 is offline   Reply With Quote