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