oops!!!!!

This commit is contained in:
codl 2017-09-05 00:08:23 +02:00
parent 214e1f30cd
commit e8dbcb1d14
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
2 changed files with 9 additions and 13 deletions

View File

@ -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)

View File

@ -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()