cleaning some code (from MR #9)

This commit is contained in:
Carl Chenet 2017-08-01 16:57:08 +02:00
parent 3aef77acac
commit 65242b02cf
3 changed files with 8 additions and 28 deletions

View File

@ -17,15 +17,9 @@
'''Filter an entry of the RSS feeds'''
# standard library imports
from configparser import SafeConfigParser, NoOptionError, NoSectionError
import os
import os.path
import sys
# 3rd party library imports
import feedparser
class FilterEntry(object):
class FilterEntry:
'''FilterEntry class'''
def __init__(self, elements, entry, options, byrsspatterns, rssobject, feedname):
'''Constructor of the FilterEntry class'''

View File

@ -21,12 +21,8 @@ import codecs
import importlib
import logging
import logging.handlers
import os
import sys
# 3rd party libraries imports
import feedparser
# app libraries imports
from feed2toot.addtags import AddTags
from feed2toot.cliparse import CliParse
@ -36,7 +32,7 @@ from feed2toot.removeduplicates import RemoveDuplicates
from feed2toot.tootpost import TootPost
from feed2toot.feedcache import FeedCache
class Main(object):
class Main:
'''Main class of Feed2toot'''
def __init__(self):
@ -164,7 +160,7 @@ class Main(object):
nospace = nospace.replace(" ", "")
rss['hashtags'].append('#{}'.format(nospace))
elements=[]
elements = []
for i in tweetformat.split(' '):
tmpelement = ''
# if i is not an empty string

View File

@ -15,16 +15,7 @@
"""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
import feedparser
from mastodon import Mastodon
class TootPost:
@ -40,13 +31,12 @@ class TootPost:
def main(self):
'''Main of the TweetPost class'''
mastodon = Mastodon(
client_id = self.config.get('mastodon', 'client_credentials'),
access_token = self.config.get('mastodon', 'user_credentials'),
api_base_url = self.config.get('mastodon', 'instance_url')
client_id=self.config.get('mastodon', 'client_credentials'),
access_token=self.config.get('mastodon', 'user_credentials'),
api_base_url=self.config.get('mastodon', 'instance_url')
)
mastodon.status_post(self.toot,
visibility=self.config.get(
'mastodon', 'toot_visibility', fallback='public'))
toot_visibility = self.config.get('mastodon', 'toot_visibility', fallback='public')
mastodon.status_post(self.toot, visibility=toot_visibility)
def storeit(self):
'''Indicate if the tweet should be stored or not'''