Added better error handling on delete status

This commit is contained in:
Bofh 2021-02-08 21:20:28 +01:00
parent 6db3fad9e3
commit ccbf23891b
1 changed files with 4 additions and 1 deletions

View File

@ -98,10 +98,13 @@ def delete_statuses(acc_id):
# check our information to validate our account exists
r = requests.get( 'https://'+config()['instance']+'/api/pixelfed/v1/accounts/verify_credentials', cookies=accdata['cookie'])
if r.status_code != 200:
print('E| user "{}" is not logged in. Please log in'.format(acc_id))
return 2
pixdata = json.loads(r.text)
if not 'id' in pixdata:
print('E| fatal! API is not working!. Might be a connectivity issue or the Account does Not Exist??'.format(acc_id))
return 2
return 3
_, _token = pixelfed_token_url('', accdata['cookie'])
_headers = {