check for gid existing
This commit is contained in:
		@@ -101,6 +101,9 @@ def create_tasks_in_tracker(data):
 | 
			
		||||
    ya_imported_task_response = {}
 | 
			
		||||
 | 
			
		||||
    for task in data:
 | 
			
		||||
        if 'gid' not in task:
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
        if task.get('assignee') and 'gid' in task['assignee']:
 | 
			
		||||
            ya_assignee = assignee.get(task['assignee']['gid'], 'dr.cyrill')
 | 
			
		||||
        else:
 | 
			
		||||
@@ -144,11 +147,12 @@ def create_tasks_in_tracker(data):
 | 
			
		||||
    for gid, parent_id in parent_task_ids.items():
 | 
			
		||||
        assign_parent_task(gid, parent_id)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#и эта функция для родительской задачи написана
 | 
			
		||||
def assign_parent_task(child_gid, parent_id):
 | 
			
		||||
def assign_parent_task(gid, parent_id):
 | 
			
		||||
    """ Назначение родительской задачи """
 | 
			
		||||
 | 
			
		||||
    base_url = f'https://api.tracker.yandex.net/v2/issues/{child_gid}'
 | 
			
		||||
    base_url = f'https://api.tracker.yandex.net/v2/issues/{gid}'
 | 
			
		||||
    headers = {
 | 
			
		||||
        'Host': 'api.tracker.yandex.net',
 | 
			
		||||
        'Authorization': 'OAuth y0_AgAEA7qkB3KjAArkXwAAAADzMlP9oR1lwMzBS2e94jHzdnII8Laxi7k',
 | 
			
		||||
@@ -176,6 +180,7 @@ def assign_parent_task(child_gid, parent_id):
 | 
			
		||||
    logger.debug('Response: %s', response.content)
 | 
			
		||||
# здесь я закончила добавлять про родительскую задачу с большой надеждой
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
file = open(asana_data_json, "r", encoding="utf8")
 | 
			
		||||
json_data = json.loads(file.read())
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user