twitter: raise temporaryerror when no access instead of silently failing

This commit is contained in:
codl 2019-02-24 12:48:58 +01:00
parent 68ac747f7e
commit 60e2357597
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 1 additions and 6 deletions

View File

@ -92,7 +92,7 @@ def get_twitter_for_acc(account):
except URLError as e: except URLError as e:
raise TemporaryError(e) raise TemporaryError(e)
return None raise TemporaryError("No access to account {}".format(account))
locale.setlocale(locale.LC_TIME, 'C') locale.setlocale(locale.LC_TIME, 'C')
@ -125,9 +125,6 @@ def post_from_api_tweet_object(tweet, post=None):
def fetch_acc(account, cursor): def fetch_acc(account, cursor):
t = get_twitter_for_acc(account) t = get_twitter_for_acc(account)
if not t:
print("no twitter access, aborting")
return
try: try:
user = t.account.verify_credentials() user = t.account.verify_credentials()
@ -176,8 +173,6 @@ def refresh_posts(posts):
return posts return posts
t = get_twitter_for_acc(posts[0].author) t = get_twitter_for_acc(posts[0].author)
if not t:
return
try: try:
tweets = t.statuses.lookup( tweets = t.statuses.lookup(
_id=",".join((post.twitter_id for post in posts)), _id=",".join((post.twitter_id for post in posts)),