问题描述
这个问题与使用带有 curl get 请求的请求包有关。
我想向 TTN swagger 发送 Curl GET 请求并显示正文。 swagger 的 TheThingsNetwork API:https://www.thethingsnetwork.org/docs/applications/storage/api.html 我正在使用以下工具来转换 swagger 页面提供的 Curl get 请求语法: https://curl.trillworks.com/ 和以下python代码:
import requests
headers = {
'Accept': 'application/json','Authorization': 'key ttn-account-v2.o-bliRC09pUnCwcg8fU2pHS8eQHjZJPxSjm7h8kDfOI',}
params = (
('last','1h'),)
response = requests.get('https://heltec_ecosoph.data.thethingsnetwork.org/api/v2/query/heltec2',headers=headers,params=params)
print(type(response))
#NB. Original query string below. It seems impossible to parse and
#reproduce query strings 100% accurately so the one below is given
#in case the reproduced version is not "correct".
# response = requests.get('https://heltec_ecosoph.data.thethingsnetwork.org/api/v2/query/heltec2?last=1h',headers=headers)
我只收到 200 作为响应,这意味着我可以使用 swagger 进行身份验证。但是,我想显示“正文内容”而不是“响应代码”。
精确输出:
代码中的响应类型如下:
正文应如下所示: enter image description here
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)