fix(close_tasks): improper endpoints and data structure manipulation

This commit is contained in:
cyrill 2023-12-11 19:45:36 +05:00
parent c36858f891
commit f3cac73622

View File

@ -45,15 +45,20 @@ def close_tasks_in_queue(queue_name):
if response.status_code == 200:
logger.debug('Response: %s', response.content)
tasks = response.json().get('status', [])
tasks = response.json()
for task in tasks:
task_id = task['issue-id']
task_id = task['id']
close_payload = {
'status': 'resolved', # Установка статуса "Закрыт"
#'status': 'resolved', # Установка статуса "Закрыт"
#'comment': 'Задача была создана в тестовом режиме'
'resolution': 'fixed'
}
close_url = f'https://api.tracker.yandex.net/v2/issues/{task_id}'
close_response = requests.patch(
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)