refactor(mapping): delete unusable parts of skript (with "#")

This commit is contained in:
Angelina Tingaeva 2023-11-29 11:53:30 +05:00
parent d528153b0f
commit 64c730ad18

View File

@ -1,4 +1,3 @@
import csv import csv
import json import json
import os import os
@ -6,21 +5,10 @@ import sys
import logging import logging
import requests 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') 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__)) base_dir = os.path.dirname(os.path.realpath(__file__))
asana_data_json = os.path.join(base_dir, './data/data_asana.json') asana_data_json = os.path.join(base_dir, './data/data_asana.json')
users_data = os.path.join(base_dir, './data/users.mapping.asana2ya.csv') users_data = os.path.join(base_dir, './data/users.mapping.asana2ya.csv')
@ -66,10 +54,6 @@ def transform_data(data):
'createdAt': task['created_at'], 'createdAt': task['created_at'],
'deadline': task['due_on'], 'deadline': task['due_on'],
'assignee': task['assignee'], 'assignee': task['assignee'],
# 'milestone': task['section'],
# 'memberships': task['memberships'],
# 'parent': task[''],
# 'status': task['completed'],
} }
transformed_data.append(transformed_task) transformed_data.append(transformed_task)
return transformed_data return transformed_data
@ -81,7 +65,6 @@ def create_tasks_in_tracker(data):
base_url = 'https://api.tracker.yandex.net/v2/issues/_import' base_url = 'https://api.tracker.yandex.net/v2/issues/_import'
headers = { headers = {
'Host': 'api.tracker.yandex.net', 'Host': 'api.tracker.yandex.net',
# 'Authorization': 'OAuth y0_AgAEA7qkB3KjAArTqQAAAADzHp7Ut0nhAmx5Q_25b1jpqiuBXRIJksk',
'Authorization': 'OAuth y0_AgAEA7qkB3KjAArkXwAAAADzMlP9oR1lwMzBS2e94jHzdnII8Laxi7k', 'Authorization': 'OAuth y0_AgAEA7qkB3KjAArkXwAAAADzMlP9oR1lwMzBS2e94jHzdnII8Laxi7k',
'X-Org-ID': '7095769', 'X-Org-ID': '7095769',
'Content-Type': 'appication/json', 'Content-Type': 'appication/json',
@ -89,8 +72,6 @@ def create_tasks_in_tracker(data):
for task in data: for task in data:
if task.get('assignee') and 'gid' in task['assignee']: if task.get('assignee') and 'gid' in task['assignee']:
ya_assignee = assignee.get(task['assignee']['gid'], 'dr.cyrill') 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: else:
ya_assignee = 'dr.cyrill' ya_assignee = 'dr.cyrill'