diff --git a/mapping.py b/mapping.py index f032578..d868eb9 100644 --- a/mapping.py +++ b/mapping.py @@ -85,7 +85,7 @@ def transform_data(data): return transformed_data -def create_tasks_in_tracker(data): +def create_tasks_in_tracker(data, limit=10): """ Создание задач в ЯндексТрекер """ base_url = 'https://api.tracker.yandex.net/v2/issues/_import' @@ -95,13 +95,14 @@ def create_tasks_in_tracker(data): 'X-Org-ID': '7095769', 'Content-Type': 'appication/json', } - datalen = len(data) + datalen = min(limit, len(data)) logger.info('Import started. Task count: %d', datalen) # этот датасет тоже для parent добавлен ya_imported_task_response = {} - for task in data: + for i in range(datalen): + task = data[i] if task.get('assignee') and 'gid' in task['assignee']: ya_assignee = assignee.get(task['assignee']['gid'], 'dr.cyrill') @@ -187,4 +188,4 @@ file = open(asana_data_json, "r", encoding="utf8") json_data = json.loads(file.read()) yandex_tracker_data = transform_data(json_data) -create_tasks_in_tracker(yandex_tracker_data) +create_tasks_in_tracker(yandex_tracker_data, limit=10)