codacy
This commit is contained in:
parent
4f1fb8f262
commit
1b07bf1020
|
@ -5,7 +5,7 @@ from flask import make_response, abort
|
||||||
import secrets
|
import secrets
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
import base64
|
||||||
import pickle
|
import pickle # nosec
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class ImgProxyCache(object):
|
||||||
body = self.redis.get(self.key('body', url))
|
body = self.redis.get(self.key('body', url))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
headers = pickle.loads(headers)
|
headers = pickle.loads(headers) # nosec
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.redis.delete(self.key('headers', url))
|
self.redis.delete(self.key('headers', url))
|
||||||
headers = None
|
headers = None
|
||||||
|
|
|
@ -4,7 +4,6 @@ from mastodon.Mastodon import MastodonAPIError, MastodonNetworkError,\
|
||||||
from model import MastodonApp, Account, OAuthToken, Post
|
from model import MastodonApp, Account, OAuthToken, Post
|
||||||
from requests import head
|
from requests import head
|
||||||
from app import db, sentry
|
from app import db, sentry
|
||||||
from math import inf
|
|
||||||
from libforget.exceptions import TemporaryError
|
from libforget.exceptions import TemporaryError
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
|
@ -84,7 +83,7 @@ def get_api_for_acc(account):
|
||||||
# doesnt error even if the token is revoked lol
|
# doesnt error even if the token is revoked lol
|
||||||
# https://github.com/tootsuite/mastodon/issues/4637
|
# https://github.com/tootsuite/mastodon/issues/4637
|
||||||
# so we have to do this:
|
# so we have to do this:
|
||||||
tl = api.timeline()
|
api.timeline()
|
||||||
return api
|
return api
|
||||||
except MastodonAPIError as e:
|
except MastodonAPIError as e:
|
||||||
if 'token' in str(e):
|
if 'token' in str(e):
|
||||||
|
|
Loading…
Reference in New Issue