下面是我的源码,跑完以后没有输出结果,求解
import urllib
import json
client_id ='MXtLCiwa0weGEeXZs90QdB8u'
client_secret ='UH33qfHXuzQZld3tcoSnTvkfQGCEa1ku'
def get_token():
host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=' + client_id + '&client_secret=' + client_secret
request = urllib.request.Request(host)
request.add_header('Content-Type', 'application/json; charset=UTF-8')
response = urllib.request.urlopen(request)
token_content = response.read()
if token_content:
token_info = json.loads(token_content)
token_key = token_info['access_token']
return token_key
print(token_key)
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
你调用的哪个接口?