百度云申请accesstoken

import requests
def main():
api_key ='自己申请的'
secret_key ='自己申请的'
    token_url ='https://aip.baidubce.com/oauth/2.0/token'
url =f"{token_url}?grant_type=client_credentials&client_id={api_key}&client_secret={secret_key}"
payload =""
headers ={
'Content-Type':'application/json',
'Accept':'application/json'
}
response =requests.request("POST",url,headers=headers,data=payload)
print(response.text)
if __name__=='__main__':
main()

 

 
posted @ 2024-11-26 09:17  艾鑫4646  阅读(2)  评论(0编辑  收藏  举报