Commit 1652a254 by lichenggang

digkey 记录token

parent 0b7fa0fc
Showing with 7 additions and 1 deletions
......@@ -7,9 +7,11 @@ import requests
from retry import retry
import token_lib
from utils.robots import dd_send_msg
from log_manage import get_logger
apidigikey_log = get_logger('apidigikey_token_info')
PLATFORM = "apidigikey"
LEVEL = "HH"
LEVEL = "TM"
BACK_NUM = 0
MODE = "redis"
MAIN_NUM = THREAD_NUM = 1
......@@ -46,6 +48,8 @@ class DGTokenCrawler(token_lib.BaseTokenCrawler):
def collect_token(self):
try:
access_token, refresh_token = self.get_token_by_refresh_token()
apidigikey_log.info(access_token)
apidigikey_log.info(refresh_token)
return access_token, refresh_token
except Exception:
dd_send_msg('digikey token同步失败:' + traceback.format_exc())
......@@ -83,5 +87,6 @@ class DGTokenCrawler(token_lib.BaseTokenCrawler):
def process(self, is_main):
access_token, refresh_token = self.collect_token()
self._redis.set(self.token_key, access_token)
self._redis.set(self.refresh_token_key, refresh_token)
......@@ -23,6 +23,7 @@ LEVEL_MAP = {
"B": 30, # 仅供测试用
"X": 60,
"C": 60 * 5,
"TM": 60 * 20,
"HH": 60 * 30,
"H": 60 * 60,
"4H": 60 * 60 * 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment