huangyifan 1 год назад
Родитель
Сommit
c9dd6f0b47
1 измененных файлов с 21 добавлено и 5 удалено
  1. 21 5
      start_sync_amz_RightNowRun.py

+ 21 - 5
start_sync_amz_RightNowRun.py

@@ -1,12 +1,28 @@
-# from sync_amz_data.tasks.account import AccountTask
-# from sync_amz_data.settings import LOG_CONF
-# import logging.config
-# logging.config.dictConfig(LOG_CONF)
+from sync_amz_data.tasks.account import AccountTask
+from sync_amz_data.settings import LOG_CONF
+import logging.config
+logging.config.dictConfig(LOG_CONF)
 import time
+import requests
 
-from sync_amz_data.public.amz_ad_client import shop_infos
+# from sync_amz_data.public.amz_ad_client import shop_infos
 from sync_amz_data.DataTransform.Data_ETL import Common_ETLMethod,SP_ETL,SB_ETL,SD_ETL
 
+def shop_infos(profile_id):
+    resp_rel = requests.get("http://192.168.1.225/api/ad_manage/profiles/",headers={"X-Token": "da4ab6bc5cbf1dfa"})
+    data = resp_rel.json().get("data")
+    profile_info = {}
+    for info in data:
+        if info.get("profile_id") in [int(profile_id),str(profile_id)]:
+            profile_info["profile_id"] = profile_id
+            profile_info["refresh_token"] = info.get("refresh_token")
+            profile_info["account_name"] = info.get("account_name")
+            profile_info["advertiser_id"] = info.get("advertiser_id")
+            profile_info["country_code"] = info.get("country_code")
+            profile_info["marketplace_str_id"] =info.get("marketplace_str_id")
+            profile_info["time_zone"] = info.get("time_zone")
+            return profile_info
+    return resp_rel.text
 
 def amz_report(conn,AWS_CREDENTIALS,para=None):
     refresh_token = shop_infos(AWS_CREDENTIALS['profile_id'])['refresh_token']