Compare commits

..

2 commits

Author SHA1 Message Date
localhost_frssoft 1a7bb87640 Retry get context (forget time) 2022-09-05 16:49:48 +03:00
localhost_frssoft d57caad024 Retry get context 2022-09-05 16:44:39 +03:00

View file

@ -1,4 +1,5 @@
from config import instance from config import instance
import time
import json import json
import requests import requests
import logging import logging
@ -30,7 +31,18 @@ def mark_as_read_notification(id_notification):
def get_status_context(status_id): def get_status_context(status_id):
r = requests.get(instance_point + f"/statuses/{status_id}/context", headers=headers) r = requests.get(instance_point + f"/statuses/{status_id}/context", headers=headers)
return r.json() if r.status_code == 200:
return r.json()
else:
http_code = r.status_code
logger.error(f'Ошибка получения контекста треда {status_id}: {http_code}')
while r.status_code != 200:
time.sleep(30)
logger.info('Повторный запрос треда...')
r = requests.get(instance_point + f"/statuses/{status_id}/context", headers=headers)
return r.json()
def get_status(status_id): def get_status(status_id):