refactor(mapping): delete unusable parts of skript (with "#")
This commit is contained in:
		
							
								
								
									
										19
									
								
								mapping.py
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								mapping.py
									
									
									
									
									
								
							@@ -1,4 +1,3 @@
 | 
			
		||||
 | 
			
		||||
import csv
 | 
			
		||||
import json
 | 
			
		||||
import os
 | 
			
		||||
@@ -6,21 +5,10 @@ import sys
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import requests
 | 
			
		||||
# from yandex_tracker_client import TrackerClient
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# YANDEX_TRACKER_TOKEN = 'y0_AgAAAABAmFP8AArkXwAAAADzJvmiOpP3VkBkQXyHUPEkimPtj5LvovE'
 | 
			
		||||
# ORG_ID = '7095769'
 | 
			
		||||
# TESTIMPORT = 'https://tracker.yandex.ru/pages/projects/5'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
logging.basicConfig(level=logging.DEBUG, filename='mapping.log', filemode='w')
 | 
			
		||||
 | 
			
		||||
# client = TrackerClient(
 | 
			
		||||
#     token='YANDEX_TRACKER_TOKEN',
 | 
			
		||||
#     org_id='ORG_ID'
 | 
			
		||||
# )
 | 
			
		||||
 | 
			
		||||
base_dir = os.path.dirname(os.path.realpath(__file__))
 | 
			
		||||
asana_data_json = os.path.join(base_dir, './data/data_asana.json')
 | 
			
		||||
users_data = os.path.join(base_dir, './data/users.mapping.asana2ya.csv')
 | 
			
		||||
@@ -66,10 +54,6 @@ def transform_data(data):
 | 
			
		||||
            'createdAt': task['created_at'],
 | 
			
		||||
            'deadline': task['due_on'],
 | 
			
		||||
            'assignee': task['assignee'],
 | 
			
		||||
            # 'milestone': task['section'],
 | 
			
		||||
            # 'memberships': task['memberships'],
 | 
			
		||||
            # 'parent': task[''],
 | 
			
		||||
            # 'status': task['completed'],
 | 
			
		||||
        }
 | 
			
		||||
        transformed_data.append(transformed_task)
 | 
			
		||||
    return transformed_data
 | 
			
		||||
@@ -81,7 +65,6 @@ def create_tasks_in_tracker(data):
 | 
			
		||||
    base_url = 'https://api.tracker.yandex.net/v2/issues/_import'
 | 
			
		||||
    headers = {
 | 
			
		||||
        'Host': 'api.tracker.yandex.net',
 | 
			
		||||
        # 'Authorization': 'OAuth y0_AgAEA7qkB3KjAArTqQAAAADzHp7Ut0nhAmx5Q_25b1jpqiuBXRIJksk',
 | 
			
		||||
        'Authorization': 'OAuth y0_AgAEA7qkB3KjAArkXwAAAADzMlP9oR1lwMzBS2e94jHzdnII8Laxi7k',
 | 
			
		||||
        'X-Org-ID': '7095769',
 | 
			
		||||
        'Content-Type': 'appication/json',
 | 
			
		||||
@@ -89,8 +72,6 @@ def create_tasks_in_tracker(data):
 | 
			
		||||
    for task in data:
 | 
			
		||||
        if task.get('assignee') and 'gid' in task['assignee']:
 | 
			
		||||
            ya_assignee = assignee.get(task['assignee']['gid'], 'dr.cyrill')
 | 
			
		||||
        # elif task.get('assignee') and 'name' == 'segavol' in task['assignee']:
 | 
			
		||||
        #     ya_assignee = assignee.get(task['assignee']['gid'], 'segavol.dev')
 | 
			
		||||
        else:
 | 
			
		||||
            ya_assignee = 'dr.cyrill'
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user