简体   繁体   English

无法将不记名 api 令牌键入 Postman Santau.io api

[英]Cannot key in bearer api token into Postman Santau.io api

The below link is the santau.io api documentation.下面的链接是 santau.io api 文档。

https://documenter.getpostman.com/view/6411292/TVev3iy5 https://documenter.getpostman.com/view/6411292/TVev3iy5

I am using python code.我正在使用 python 代码。 However, if I type the code below, I could not extract the data as expected.但是,如果我键入下面的代码,则无法按预期提取数据。 The weird thing is that it does not show how to key in the bearer api token into the code to get authorized for extracting the data.奇怪的是,它没有显示如何将承载 api 令牌键入代码以获得提取数据的授权。 Anyone have experience to deal with it?任何人都有处理它的经验?

Updated code更新代码

import requests

url = "https://santau.io/api/v1/histories?name=3A&start_date=2019-08-13&end_date=2020-08-15&limit=100&offset=0"

api_token="B67KqyJstY4SLrf4......" #not real API token, just an example

payload={}
headers ={"Authorization": "Bearer " + api_token}
response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

After you register http://santau.io/register , you can get API token.注册http://santau.io/register 后,您可以获得 API 令牌。

在此处输入图片说明

Then you put it to header to make a request.然后你把它放到 header 中以发出请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM