Advertisement
okubax

gmail.py

Feb 8th, 2014
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. from urllib.request import FancyURLopener
  4.  
  5. username = 'user@gmail.com'
  6. password = 'your_password'
  7.  
  8. url = 'https://%s:%s@mail.google.com/mail/feed/atom' % (username, password)
  9.  
  10. opener = FancyURLopener()
  11. page = opener.open(url)
  12.  
  13. contents = page.read().decode('utf-8')
  14.  
  15.  
  16. ifrom = contents.index('<fullcount>') + 11
  17. ito = contents.index('</fullcount>')
  18.  
  19. unread = contents[ifrom:ito]
  20.  
  21. print(unread)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement