first commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# encoding:utf-8
|
||||
import requests
|
||||
|
||||
|
||||
def get_tocken():
|
||||
# client_id 为官网获取的AK, client_secret 为官网获取的SK
|
||||
host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=FyoTjwDbVU518TGN2BBgg3If&client_secret=zatBI2fmKwYHzIicsOh9X4OYRcXbtXsO'
|
||||
response = requests.get(host)
|
||||
if response:
|
||||
return response.json()
|
||||
else:
|
||||
return "error"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=FyoTjwDbVU518TGN2BBgg3If&client_secret=zatBI2fmKwYHzIicsOh9X4OYRcXbtXsO'
|
||||
response = requests.get(host)
|
||||
print(response.json())
|
||||
Reference in New Issue
Block a user