From 14605476c8ffb13464be1980bc267f4c2c3b0d7e Mon Sep 17 00:00:00 2001 From: Angelina Tingaeva Date: Mon, 27 Nov 2023 23:09:21 +0500 Subject: [PATCH] refactor(mapping): make new token, mask Python client because of OAuth --- mapping.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mapping.py b/mapping.py index 4e9bdb4..d082bff 100644 --- a/mapping.py +++ b/mapping.py @@ -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,