market_assistant/authentication.py

14 lines
355 B
Python

import requests
def get_access_token(api_key, api_secret):
url = "https://chatglm.cn/chatglm/assistant-api/v1/get_token"
data = {
"api_key": api_key,
"api_secret": api_secret
}
response = requests.post(url, json=data)
token_info = response.json()
print(token_info)
return token_info['result']['access_token']