mirror of
https://github.com/nikdoof/flexget-plugins.git
synced 2025-12-13 05:12:15 +00:00
Move twitter importing to the actual class, avoid not having python-twitter installed bombing running Flexget even if you don't use it.
This commit is contained in:
@@ -43,8 +43,15 @@ class OutputTwitter:
|
||||
config.setdefault('active', False)
|
||||
return config
|
||||
|
||||
def on_process_start(self, feed, config):
|
||||
try:
|
||||
import twitter
|
||||
except ImportError:
|
||||
raise PluginError('Unable to import module twitter, python-twitter is required to use output_twitter')
|
||||
|
||||
def on_feed_exit(self, feed):
|
||||
"""Send email at exit."""
|
||||
import twitter
|
||||
config = self.get_config(feed)
|
||||
|
||||
if not config['active']:
|
||||
@@ -78,10 +85,5 @@ class OutputTwitter:
|
||||
log.debug("Sending Twitter: %s", content)
|
||||
api.PostUpdate(content)
|
||||
|
||||
try:
|
||||
import twitter
|
||||
except ImportError:
|
||||
raise PluginError('Unable to import module twitter, python-twitter is required to use output_twitter')
|
||||
else:
|
||||
log.debug("Registering plugin: twitter")
|
||||
register_plugin(OutputTwitter, 'twitter')
|
||||
log.debug("Registering plugin: twitter")
|
||||
register_plugin(OutputTwitter, 'twitter')
|
||||
|
||||
Reference in New Issue
Block a user