diff --git a/resolved_task.py b/resolved_task.py index a0252ce..a8df0fa 100644 --- a/resolved_task.py +++ b/resolved_task.py @@ -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', # Установка статуса "Закрыт" - # 'comment': 'Задача была создана в тестовом режиме' + #'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)