"

乐虎体育官网拥有全球最顶尖的原生APP,每天为您提供千场精彩体育赛事,乐虎体育官网更有真人、彩票、电子老虎机、真人电子竞技游戏等多种娱乐方式选择,乐虎体育官网让您尽享娱乐、赛事投注等,且无后顾之忧!

<cite id="jnxbr"></cite>
<cite id="jnxbr"></cite>
<cite id="jnxbr"><video id="jnxbr"></video></cite><cite id="jnxbr"></cite>
<cite id="jnxbr"></cite>
<var id="jnxbr"><strike id="jnxbr"></strike></var>
<cite id="jnxbr"><span id="jnxbr"><menuitem id="jnxbr"></menuitem></span></cite>
<cite id="jnxbr"></cite>
<cite id="jnxbr"><span id="jnxbr"></span></cite>
<cite id="jnxbr"></cite>
<cite id="jnxbr"></cite>
<cite id="jnxbr"></cite>
<var id="jnxbr"></var>
<cite id="jnxbr"></cite>
<cite id="jnxbr"></cite>
<cite id="jnxbr"></cite>
<var id="jnxbr"><strike id="jnxbr"><thead id="jnxbr"></thead></strike></var>
<cite id="jnxbr"><video id="jnxbr"><thead id="jnxbr"></thead></video></cite>
"

生成SAP Leonardo API Access Token的python代码

小编:啊南 19阅读 2020.12.08

!/usr/bin/env python-- coding: utf-8 --
import os
import sys

import requests
def get_request_header(xsuaa_base_url, client_id, client_secret):
    response = requests.post(url=xsuaa_base_url + '/oauth/token',
                             data={'grant_type': 'client_credentials',
                                   'client_id': client_id,
                                   'client_secret': client_secret})
    access_token = response.json()["access_token"];
    with open("C:\\Python27\\911.txt", "w") as f:
        f.write(access_token)
        f.close()
    print(access_token);
    
    return {'Authorization': 'Bearer {}'.format(access_token), 'Accept': 'application/json'}


xsuaa_base_url = 'https://jerry.authentication.sap.hana.ondemand.com';
client_id = 'sb-15537af7-4eae-4a5b-b47d-3e6299010b87!b7033|ml-foundation-xsuaa-std!b313';
client_secret = 'jBwKqk5OdUHQKeCgk5EyHoyBJkk=';

print(get_request_header(xsuaa_base_url, client_id, client_secret));

需要修改client_id,secret, token是有时间限制的,需要每次重新生成, 每次生成都写入一个txt里方便使用, python代码参考链接:https://help.sap.com/viewer/ed8bf217360e4ad7bcbec7707c017a82/1906B/en-US/066e68162d7249bcb4a8b615cdd7e2a3.html

关联标签:
乐虎体育官网