cleaning some code (from MR #9)
This commit is contained in:
parent
3aef77acac
commit
65242b02cf
|
@ -17,15 +17,9 @@
|
||||||
'''Filter an entry of the RSS feeds'''
|
'''Filter an entry of the RSS feeds'''
|
||||||
|
|
||||||
# standard library imports
|
# standard library imports
|
||||||
from configparser import SafeConfigParser, NoOptionError, NoSectionError
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# 3rd party library imports
|
class FilterEntry:
|
||||||
import feedparser
|
|
||||||
|
|
||||||
class FilterEntry(object):
|
|
||||||
'''FilterEntry class'''
|
'''FilterEntry class'''
|
||||||
def __init__(self, elements, entry, options, byrsspatterns, rssobject, feedname):
|
def __init__(self, elements, entry, options, byrsspatterns, rssobject, feedname):
|
||||||
'''Constructor of the FilterEntry class'''
|
'''Constructor of the FilterEntry class'''
|
||||||
|
|
|
@ -21,12 +21,8 @@ import codecs
|
||||||
import importlib
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# 3rd party libraries imports
|
|
||||||
import feedparser
|
|
||||||
|
|
||||||
# app libraries imports
|
# app libraries imports
|
||||||
from feed2toot.addtags import AddTags
|
from feed2toot.addtags import AddTags
|
||||||
from feed2toot.cliparse import CliParse
|
from feed2toot.cliparse import CliParse
|
||||||
|
@ -36,7 +32,7 @@ from feed2toot.removeduplicates import RemoveDuplicates
|
||||||
from feed2toot.tootpost import TootPost
|
from feed2toot.tootpost import TootPost
|
||||||
from feed2toot.feedcache import FeedCache
|
from feed2toot.feedcache import FeedCache
|
||||||
|
|
||||||
class Main(object):
|
class Main:
|
||||||
'''Main class of Feed2toot'''
|
'''Main class of Feed2toot'''
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -15,16 +15,7 @@
|
||||||
|
|
||||||
"""Checks an RSS feed and posts new entries to Mastodon."""
|
"""Checks an RSS feed and posts new entries to Mastodon."""
|
||||||
|
|
||||||
# standard libraires imports
|
|
||||||
from configparser import SafeConfigParser, NoOptionError, NoSectionError
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
import codecs
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# 3rd party libraries imports
|
# 3rd party libraries imports
|
||||||
import feedparser
|
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
|
|
||||||
class TootPost:
|
class TootPost:
|
||||||
|
@ -44,9 +35,8 @@ class TootPost:
|
||||||
access_token=self.config.get('mastodon', 'user_credentials'),
|
access_token=self.config.get('mastodon', 'user_credentials'),
|
||||||
api_base_url=self.config.get('mastodon', 'instance_url')
|
api_base_url=self.config.get('mastodon', 'instance_url')
|
||||||
)
|
)
|
||||||
mastodon.status_post(self.toot,
|
toot_visibility = self.config.get('mastodon', 'toot_visibility', fallback='public')
|
||||||
visibility=self.config.get(
|
mastodon.status_post(self.toot, visibility=toot_visibility)
|
||||||
'mastodon', 'toot_visibility', fallback='public'))
|
|
||||||
|
|
||||||
def storeit(self):
|
def storeit(self):
|
||||||
'''Indicate if the tweet should be stored or not'''
|
'''Indicate if the tweet should be stored or not'''
|
||||||
|
|
Loading…
Reference in a new issue