Python3令牌请求返回错误的凭证错误,但可从邮递员那里使用

时间:2019-07-10 13:11:37

标签: python-3.x oauth-2.0

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了,

0 个答案:

没有答案