refactor(mapping): include logging

This commit is contained in:
Angelina Tingaeva 2023-11-27 21:22:57 +05:00
parent db4f1b66e3
commit b354d408b2
2 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,6 @@ import json
import os import os
import sys import sys
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')

View File

@ -3,6 +3,7 @@ import csv
import json import json
import os import os
import sys import sys
import logging
import requests import requests
from yandex_tracker_client import TrackerClient from yandex_tracker_client import TrackerClient
@ -13,6 +14,8 @@ ORG_ID = '35d164dcf81e48f2b6a532f4badddd33'
# TESTIMPORT = 'https://tracker.yandex.ru/pages/projects/5' # TESTIMPORT = 'https://tracker.yandex.ru/pages/projects/5'
logging.basicConfig(level=logging.DEBUG, filename='mapping.log', filemode='w')
client = TrackerClient( client = TrackerClient(
token='YANDEX_TRACKER_TOKEN', token='YANDEX_TRACKER_TOKEN',
org_id='ORG_ID' org_id='ORG_ID'
@ -83,7 +86,7 @@ def create_tasks_in_tracker(data):
'Content-Type': 'appication/json', 'Content-Type': 'appication/json',
} }
for task in data: for task in data:
ya_assignee = assignee[task['assignee']['gid']] if task.get('assignee',0)!=0 else 'dr.cyrill@heado.ru' ya_assignee = assignee[task['assignee']['gid']] if task.get('assignee', 0) !=0 else 'dr.cyrill@heado.ru'
payload = { payload = {
'queue': 'TESTIMPORT', # Вынести в переменную 'queue': 'TESTIMPORT', # Вынести в переменную
'summary': task['summary'], 'summary': task['summary'],