refactor(mapping_parent): one more try ti create parent task

This commit is contained in:
Angelina Tingaeva 2023-12-06 16:08:36 +05:00
parent 2a5778bfe4
commit c76bb23c6d

View File

@ -56,7 +56,7 @@ def get_parent_task_ids(task, ya_imported_task_response):
parent_task_ids = {}
if task.get('parent') and 'gid' in task['parent'] and task['gid'] in ya_imported_task_response:
if task.get('parent') and 'gid' in task['parent']:
parent_gid = task['parent']['gid']
if parent_gid in ya_imported_task_response:
parent_id = ya_imported_task_response[parent_gid]
@ -146,14 +146,14 @@ def create_tasks_in_tracker(data):
parent_task_ids = get_parent_task_ids(task, ya_imported_task_response)
for gid, parent_id in parent_task_ids.items():
assign_parent_task(gid, parent_id)
assign_parent_task(ya_imported_task_response[gid], parent_id)
#и эта функция для родительской задачи написана
def assign_parent_task(gid, parent_id):
def assign_parent_task(id, parent_id):
""" Назначение родительской задачи """
base_url = f'https://api.tracker.yandex.net/v2/issues/{gid}'
base_url = f'https://api.tracker.yandex.net/v2/issues/{id}'
headers = {
'Host': 'api.tracker.yandex.net',
'Authorization': 'OAuth y0_AgAEA7qkB3KjAArkXwAAAADzMlP9oR1lwMzBS2e94jHzdnII8Laxi7k',