From 5649c173da5db9c805f3971102f46f6d29b342c1 Mon Sep 17 00:00:00 2001 From: yk Date: Tue, 18 Jan 2022 23:09:24 +0800 Subject: [PATCH] Fixed Issue #5 --- cs_methods.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cs_methods.py b/cs_methods.py index 8fddec2..6b7b2ea 100644 --- a/cs_methods.py +++ b/cs_methods.py @@ -123,15 +123,16 @@ def get_token_request() -> str: """ global TOKEN_REQ_TIME + headers = { + 'Content-Type': 'application/x-www-form-urlencoded' + } body = { 'client_id': CLIENT_ID, 'client_secret': SECRET } - headers = { - 'Authorization': HEADERS['Authorization'] - } - token_res = http_request('POST', '/oauth2/token', data=body, headers=headers, safe=True, - get_token_flag=False) + + token_res = http_request('POST', '/oauth2/token', data=body, headers=headers, safe=True, get_token_flag=False) + try: TOKEN_REQ_TIME = datetime.now() return token_res.get('access_token')