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