加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

无法获得imgur v3 api请求授权使用curl或其他bash实用程序

发布时间:2020-12-13 23:10:15 所属栏目:Linux 来源:网络整理
导读:我正在尝试使用 v3 imgur api从imgur.com获取一些公共数据,但每当我使用curl发出请求时,我都会获得401. 这就是我调用API的方式(using this example from the example python app) – curl -F "Authorization=Client-ID my_client_id_provided_by_registering
我正在尝试使用 v3 imgur api从imgur.com获取一些公共数据,但每当我使用curl发出请求时,我都会获得401.

这就是我调用API的方式(using this example from the example python app) –

curl -F "Authorization=Client-ID <my_client_id_provided_by_registering_my_app>" https://api.imgur.com/3/gallery/hot/viral/0.json

我也试过了

curl -F "client_id=<my_client_id>" https://api.imgur.com/3/gallery/hot/viral/0.json

所以我的问题是,imgur api期望使用auth标头的格式是什么,我如何利用curl或其他常见的bash实用程序来利用它?

解决方法

交换机-F(或–form)用于发送HTTP表单.你应该使用的是-H( – header):

curl --header "Authorization: Client-ID $YOUR_ID" https://api.imgur.com/3/gallery/hot/viral/0.json

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读