refactor(mapping): make new token, mask Python client because of OAuth

This commit is contained in:
Angelina Tingaeva 2023-11-27 23:09:21 +05:00
parent 31f2c6b972
commit 14605476c8

View File

@ -6,20 +6,20 @@ import sys
import logging
import requests
from yandex_tracker_client import TrackerClient
# from yandex_tracker_client import TrackerClient
YANDEX_TRACKER_TOKEN = 'y0_AgAAAABAmFP8AArTqQAAAADyyFLmOoHqPprnRKag6B8okqjoDx2m9P0'
ORG_ID = '35d164dcf81e48f2b6a532f4badddd33'
# 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'
)
# 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')
@ -69,7 +69,7 @@ def transform_data(data):
# 'milestone': task['section'],
# 'memberships': task['memberships'],
# 'parent': task[''],
'status': task['completed'],
# 'status': task['completed'],
}
transformed_data.append(transformed_task)
return transformed_data
@ -81,7 +81,8 @@ 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_AgAEA7qkB3KjAArTqQAAAADzHp7Ut0nhAmx5Q_25b1jpqiuBXRIJksk',
'Authorization': 'OAuth y0_AgAAAABAmFP8AArkXwAAAADzJvmiOpP3VkBkQXyHUPEkimPtj5LvovE',
'X-Org-ID': '7095769',
'Content-Type': 'appication/json',
}
@ -98,7 +99,7 @@ def create_tasks_in_tracker(data):
# 'milestone': task['milestone'],
# 'memberships': task['memberships'],
# 'parent': task['parent'],
#'status': task['status'],
# 'status': task['status'],
}
response = requests.post(
base_url,