header = {'Content-type': 'application/json','Authorization': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }
url = 'https://sandbox-authservice.priaid.ch/login'
response = requests.post(url, headers = header, verify=False).json()
token = json.dumps(response)
print token['ValidThrough']
我想在我的webhook中打印ValidThrough属性,该属性通过POST调用作为JSON数据接收。我知道这已经在这里被问了很多次,但是打印的令牌['ValidThrough']不适用于我。我收到错误“TypeError:字符串索引必须是整数,而不是str”在Python中访问JSON数据
是的,它也返回值,它有两个属性,'Token'和'ValidThrough' –