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)
|
config.setdefault('active', False)
|
||||||
return config
|
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):
|
def on_feed_exit(self, feed):
|
||||||
"""Send email at exit."""
|
"""Send email at exit."""
|
||||||
|
import twitter
|
||||||
config = self.get_config(feed)
|
config = self.get_config(feed)
|
||||||
|
|
||||||
if not config['active']:
|
if not config['active']:
|
||||||
@@ -78,10 +85,5 @@ class OutputTwitter:
|
|||||||
log.debug("Sending Twitter: %s", content)
|
log.debug("Sending Twitter: %s", content)
|
||||||
api.PostUpdate(content)
|
api.PostUpdate(content)
|
||||||
|
|
||||||
try:
|
log.debug("Registering plugin: twitter")
|
||||||
import twitter
|
register_plugin(OutputTwitter, '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')
|
|
||||||
|
|||||||
Reference in New Issue
Block a user