Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
tas_token_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1652a254
authored
Apr 01, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
digkey 记录token
parent
0b7fa0fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
lib/apidigikey.py
token_server.py
lib/apidigikey.py
View file @
1652a254
...
...
@@ -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
)
token_server.py
View file @
1652a254
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment