从https://api.workspot.com/oauth/token请求令牌时,我得到了“错误的凭据”,但我可以使用相同的授权标头(复制并粘贴 Headers [“ Authorization”] ,从邮递员那里手动获得令牌,请参见下面)和凭据( WsControlUser,WsControlPass ):
Headers = { "Authorization": '{}'.format(HeaderAuthValue.decode('ascii'))}
print('{}'.format(Headers["Authorization"]))
url = "https://api.workspot.com/oauth/token?grant_type=password
payload = {
"username": WsControlUser,
"password": WsControlPass,
"Content-Type": "x-www-form-urlencoded"
}
ApiReturn = requests.post(url, data=json.dumps(payload), headers=Headers)
更不用说我从powershell脚本将上面的要点移植到python3了,