From e9f9d46f7e7dfadb4ddd3c541db8f8f87d3b73e7 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 16 Dec 2009 12:14:21 +0000 Subject: [PATCH] If the username/password is validated, don't recheck for each feed --- output_twitter.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/output_twitter.py b/output_twitter.py index 3360586..9bcced5 100644 --- a/output_twitter.py +++ b/output_twitter.py @@ -25,6 +25,9 @@ class OutputTwitter: password: blargh """ + + _validated = False + def validator(self): from flexget import validator twitter = validator.factory('dict') @@ -55,9 +58,12 @@ class OutputTwitter: log.debug("Loading twitter api") api = twitter.Api(username=config['username'], password=config['password']) - if not api.GetFriends(): - log.warn("Invalid twitter username or password") - return + if not self._validated: + try: + api.GetFriends() + except TwitterError: + log.warn("Error testing twitter connectivity, check your username/password") + return entries_count = len(feed.accepted) if entries_count == 0: