Handling twitter issues.

This commit is contained in:
Samuel Clay 2016-11-21 13:15:50 -08:00
parent 2b6132db3d
commit 6698967021
2 changed files with 12 additions and 3 deletions

View file

@ -584,7 +584,7 @@ def mark_story_as_shared(request):
"story_permalink": story.story_permalink,
"story_title": story.story_title,
"story_feed_id": story.story_feed_id,
"story_content_z": story.story_latest_content_z or story.story_content_z,
"story_content_z": getattr(story, 'story_latest_content_z', None) or story.story_content_z,
"story_author_name": story.story_author_name,
"story_tags": story.story_tags,
"story_date": story.story_date,

View file

@ -364,17 +364,26 @@ class FetchFeed:
return
except tweepy.error.TweepError, e:
if ((len(e.args) >= 2 and e.args[2] == 63) or
('temporarily locked' in e.args[0])):
('temporarily locked' in e.args[0].lower())):
# Suspended
logging.debug(u' ***> [%-30s] ~FRTwitter failed, user suspended, disconnecting twitter: %s: %s' %
(self.feed.title[:30], address, e))
social_services.disconnect_twitter()
return
elif 'suspended' in e.args[0]:
elif 'suspended' in e.args[0].lower():
logging.debug(u' ***> [%-30s] ~FRTwitter user suspended, disconnecting twitter: %s: %s' %
(self.feed.title[:30], address, e))
social_services.disconnect_twitter()
return
elif 'not found' in e.args[0].lower():
logging.debug(u' ***> [%-30s] ~FRTwitter user not found, disconnecting twitter: %s: %s' %
(self.feed.title[:30], address, e))
social_services.disconnect_twitter()
return
elif 'over capacity' in e.args[0].lower():
logging.debug(u' ***> [%-30s] ~FRTwitter over capacity, ignoring... %s: %s' %
(self.feed.title[:30], address, e))
return
else:
raise