Add a configuration option to accept bozo exceptions
This commit is contained in:
parent
734d9450fb
commit
ff140ae2f7
|
@ -44,6 +44,9 @@ In order to configure Feed2toot, you need to create a feed2toot.ini file (or any
|
|||
[hashtaglist]
|
||||
several_words_hashtags_list=/etc/feed2toot/hashtags.txt
|
||||
|
||||
[feedparser]
|
||||
accept_bozo_exceptions=true
|
||||
|
||||
For the [mastodon] section:
|
||||
|
||||
- instance_url: the url of your Mastodon instance
|
||||
|
@ -74,6 +77,10 @@ For the [hashtaglist] section:
|
|||
|
||||
- several_words_hashtags_list: a path to the file containing hashtags in two or more words. Absolute path is mandatory. By default Feed2toot adds a # before every words of a hashtag. See documentation below for an example of this file.
|
||||
|
||||
for the [feedparser] section:
|
||||
|
||||
- accept_bozo_exceptions: If set to true, feed2toot will accept malformed feeds, which are rejected by default.
|
||||
|
||||
Example of the list of hash tags
|
||||
================================
|
||||
The list of hash tags is a simple text file with one hash tag composed by several words on a single line::
|
||||
|
|
|
@ -45,6 +45,13 @@ class ConfParse(object):
|
|||
config = SafeConfigParser()
|
||||
if not config.read(os.path.expanduser(pathtoconfig)):
|
||||
sys.exit('Could not read config file')
|
||||
|
||||
# The feedparser section
|
||||
if config.has_option('feedparser', 'accept_bozo_exceptions'):
|
||||
self.accept_bozo_exceptions = config.getboolean('feedparser', 'accept_bozo_exceptions')
|
||||
else:
|
||||
self.accept_bozo_exceptions = False
|
||||
|
||||
###########################
|
||||
#
|
||||
# the rss section
|
||||
|
@ -117,7 +124,8 @@ class ConfParse(object):
|
|||
if 'bozo_exception' in feed:
|
||||
bozoexception = True
|
||||
logging.warning(feed['bozo_exception'])
|
||||
continue
|
||||
if not self.accept_bozo_exceptions:
|
||||
continue
|
||||
# check if the rss feed and the rss entry are valid ones
|
||||
if 'entries' in feed:
|
||||
if rssobject and rssobject not in feed['entries'][0].keys():
|
||||
|
|
Loading…
Reference in a new issue