refactor(resolved_task): make full search

This commit is contained in:
Angelina Tingaeva 2023-12-14 14:37:46 +05:00
parent 98137f11f2
commit d73a2da3e6

View File

@ -37,36 +37,38 @@ def close_tasks_in_queue(queue_name):
} }
} }
response = requests.post( while True:
base_url,
headers=headers,
data=json.dumps(payload)
)
if response.status_code == 200: response = requests.post(
logger.debug('Response: %s', response.content) base_url,
headers=headers,
data=json.dumps(payload)
)
tasks = response.json() if response.status_code == 200:
logger.debug('Response: %s', response.content)
for task in tasks: tasks = response.json()
task_id = task['id']
close_payload = { for task in tasks:
'resolution': 'fixed' task_id = task['id']
} close_payload = {
close_url = f'https://api.tracker.yandex.net/v2/issues/{task_id}/transitions/close/_execute' 'resolution': 'fixed'
print(close_url) }
print(headers) close_url = f'https://api.tracker.yandex.net/v2/issues/{task_id}/transitions/close/_execute'
close_response = requests.post( print(close_url)
close_url, print(headers)
headers=headers, close_response = requests.post(
data=json.dumps(close_payload) close_url,
) headers=headers,
if close_response.status_code == 200: data=json.dumps(close_payload)
print(f'Задача {task_id} закрыта успешно') )
else: if close_response.status_code == 200:
print(f'Ошибка при закрытии задачи {task_id}: {close_response.content}') print(f'Задача {task_id} закрыта успешно')
else: else:
print(f'Ошибка при получении задач для очереди {queue_name}: {response.content}') print(f'Ошибка при закрытии задачи {task_id}: {close_response.content}')
else:
print(f'Ошибка при получении задач для очереди {queue_name}: {response.content}')
# Вызов функции для закрытия задач в очереди 'TESTIMPORT' # Вызов функции для закрытия задач в очереди 'TESTIMPORT'