Skip to content

empty tag validation #4

@ehorohorin

Description

@ehorohorin

This piece of code

'hashtag': ' '.join(['#%s' % i for i in feed['entries'][0]['tags'][0]['term'].split()[:2]]),

generates predictable excetion if there is no tags in the feed.

% rss2twitter.py -c config.ini
ERROR, UNEXPECTED EXCEPTION
'tags'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/rss2twitter-0.0.3-py2.7.egg/EGG-INFO/scripts/rss2twitter.py", line 106, in
main()
File "/usr/local/lib/python2.7/dist-packages/rss2twitter-0.0.3-py2.7.egg/EGG-INFO/scripts/rss2twitter.py", line 95, in main
'hashtag': ' '.join(['#%s' % i for i in feed['entries'][0]['tags'][0]['term'].split()[:2]]),
File "/usr/lib/python2.7/dist-packages/feedparser.py", line 391, in getitem
return dict.getitem(self, key)
KeyError: 'tags'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions