I don't succeed to parse gmail Atom feed using feedparser with python 3.6 on windows 10 and neither on a raspberry pi running python 3.5 with ubuntu.
For the gmail account I'd like to access atom feed, I have previously setup 2 step authentification and then a password for other device ( raspberry pi )
When authentifying myself, I use the device password used successfully by ssmtp on raspberry pi to send emails from that account. With the same password, I also succeed to get the atom feed from firefox, but I guess it is still an authentification problem.
Here is the code executed and the error message on win10 with python 3.6 :
#!/usr/bin/env python
import feedparser
USERNAME = "user@gmail.com"
PASSWORD = "password"
response = feedparser.parse("https://" + USERNAME + ":" + PASSWORD + "@mail.google.com/gmail/feed/atom")
unread_count = int(response["feed"]["fullcount"])
Result:
Traceback (most recent call last):
File "C:/Users/cedric/Google Drive/raspberry-pi/feedparser_example2.py", line 7, in <module>
unread_count = int(response["feed"]["fullcount"])
File "C:\Users\cedric\AppData\Local\Programs\Python\Python36\lib\site-packages\feedparser.py", line 356, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'fullcount'
If I run it with raspberry pi with python3.5 here is the error message:
Traceback (most recent call last):
File "/home/ced/Bureau/secu/feedparser_example.py", line 14, in <module>
unread_count = int(response["feed"]["fullcount"])
File "/usr/local/lib/python3.5/dist-packages/feedparser.py", line 357, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'fullcount'
Does someone have an idea about this ? Thanks for your help