Fix import error
This commit is contained in:
parent
223656f2d2
commit
e42653f7fd
1 changed files with 11 additions and 7 deletions
|
|
@ -11,7 +11,6 @@ from django.utils.html import format_html, urlize
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
import sentry_sdk
|
|
||||||
|
|
||||||
from ftfy import fix_text
|
from ftfy import fix_text
|
||||||
from requests_oauthlib import OAuth1 as OAuth
|
from requests_oauthlib import OAuth1 as OAuth
|
||||||
|
|
@ -239,6 +238,9 @@ class TwitterClient(PostClient):
|
||||||
f"Access token expired for user {stream.rule.user.pk}"
|
f"Access token expired for user {stream.rule.user.pk}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sentry_sdk
|
||||||
|
|
||||||
with sentry_sdk.push_scope() as scope:
|
with sentry_sdk.push_scope() as scope:
|
||||||
if e.response:
|
if e.response:
|
||||||
scope.set_extra("content", e.response.content)
|
scope.set_extra("content", e.response.content)
|
||||||
|
|
@ -246,6 +248,8 @@ class TwitterClient(PostClient):
|
||||||
sentry_sdk.capture_message(
|
sentry_sdk.capture_message(
|
||||||
"Twitter authentication credentials reset"
|
"Twitter authentication credentials reset"
|
||||||
)
|
)
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
stream.rule.user.twitter_oauth_token = None
|
stream.rule.user.twitter_oauth_token = None
|
||||||
stream.rule.user.twitter_oauth_token_secret = None
|
stream.rule.user.twitter_oauth_token_secret = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue