oops!!!!!
This commit is contained in:
parent
214e1f30cd
commit
e8dbcb1d14
|
@ -9,7 +9,6 @@ from zipfile import ZipFile
|
|||
from io import BytesIO
|
||||
from lib.exceptions import PermanentError, TemporaryError
|
||||
from urllib.error import URLError
|
||||
import json
|
||||
|
||||
|
||||
def get_login_url(callback='oob', consumer_key=None, consumer_secret=None):
|
||||
|
@ -213,15 +212,12 @@ def chunk_twitter_archive(archive_id):
|
|||
|
||||
def handle_error(e):
|
||||
if isinstance(e, TwitterHTTPError):
|
||||
try:
|
||||
data = json.loads(e.read())
|
||||
if 'errors' in data.keys():
|
||||
for error in data['errors']:
|
||||
if error.get('code') == 326:
|
||||
# account locked lol rip
|
||||
# although this is a temporary error in twitter terms
|
||||
# it's best not to waste api calls on locked accounts
|
||||
raise PermanentError(e)
|
||||
except Exception:
|
||||
pass
|
||||
data = e.response_data
|
||||
if isinstance(data, dict) and 'errors' in data.keys():
|
||||
for error in data['errors']:
|
||||
if error.get('code',0) == 326:
|
||||
# account locked lol rip
|
||||
# although this is a temporary error in twitter terms
|
||||
# it's best not to waste api calls on locked accounts
|
||||
raise PermanentError(e)
|
||||
raise TemporaryError(e)
|
||||
|
|
2
tasks.py
2
tasks.py
|
@ -56,7 +56,7 @@ def make_dormant(acc):
|
|||
it, you have reactivated your account, but be aware that some posts
|
||||
may be missing from Forget's database, and it may take some time to
|
||||
get back in sync.
|
||||
'''.format(acc.service)
|
||||
'''.format(service=acc.service)
|
||||
acc.dormant = True
|
||||
db.session.commit()
|
||||
|
||||
|
|
Loading…
Reference in New Issue