Вот что я спрашиваю. Я использую mac osx 10.9, python 2.7.3, feedparser 5.1.3 на arduino yun, я пытался использовать следующий скрипт python для проверки моего Gmail, и он продолжает возвращать коды ошибок, как показано ниже.
Вот полный код:
root@ArduinoYun:~# vi 1.py
#!/usr/bin/python
import feedparser
USERNAME="[email protected]"
PASSWORD="mypsw"
PROTO="https://"
SERVER="mail.google.com"
PATH="/gmail/feed/atom"
print(feedparser.parse(PROTO+USERNAME+":"+PASSWORD+"@"+SERVER+PATH))
root@ArduinoYun:~# ./1.py
{'feed': {}, 'bozo': 1, 'bozo_exception': URLError('unknown url type: https',), 'entries': []}
После установки openssl pkg проблема, описанная выше, решена, но появилась новая... Код, как показано ниже:
...
pprint.pprint(feedparser.parse(PROTO+USERNAME+":"+PASSWORD+"@"+SERVER+PATH)["feed"])
root@ArduinoYun:~# ./1.py
{'fullcount': u'0',
'link': u'http://mail.google.com/mail',
'links': [{'href': u'http://mail.google.com/mail',
'rel': u'alternate',
'type': u'text/html'}],
'subtitle': u'New messages in your Gmail Inbox',
'subtitle_detail': {'base': u'https://mail.google.com/mail/feed/atom',
'language': None,
'type': u'text/plain',
'value': u'New messages in your Gmail Inbox'},
'title': u'Gmail - Inbox for [email protected]',
'title_detail': {'base': u'https://mail.google.com/mail/feed/atom',
'language': None,
'type': u'text/plain',
'value': u'Gmail - Inbox for [email protected]'},
'updated': u'2014-07-22T21:08:57Z',
'updated_parsed': time.struct_time(tm_year=2014, tm_mon=7, tm_mday=22, tm_hour=21, tm_min=8,
tm_sec=57, tm_wday=1, tm_yday=203, tm_isdst=0)}
Кажется, все в порядке. Но когда скрипт был изменен, как показано ниже:
...
newmail = int(feedparser.parse(PROTO+USERNAME+":"+PASSWORD+"@"+SERVER+PATH)["feed"]
["fullcount"])
root@ArduinoYun:~# ./1.py
Traceback (most recent call last):
File "./1.py", line 10, in <module>
newmail = int(feedparser.parse(PROTO+USERNAME+":"+PASSWORD+"@"+SERVER+PATH)["feed"]
["fullcount"])
File "/usr/lib/python2.7/site-packages/feedparser-5.1.3-py2.7.egg/feedparser.py", line 375,
in __getitem__
return dict.__getitem__(self, key)
KeyError: 'fullcount'
feedparser.parse('https://www.eff.org/rss/updates.xml')
? - person Bill Lynch   schedule 23.07.2014