调用 Reddit API 时出现 403 错误. [英] 403 error while calling Reddit API.

查看:56
本文介绍了调用 Reddit API 时出现 403 错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问用户保存的数据.它不断返回 403 错误,这是它的 api 端点.

I'm trying to access data saved by the user. And it keeps returning a 403 error with this being its api end point.

http://www.reddit.com/dev/api#GET_user_{用户名}_已保存

我很困惑要在我的标头中发送什么才能使这个请求工作,而且 reddit 文档根本没有提到它.帮助?

I'm thoroughly confused what to send in my headers to make this request work and the reddit documentation has no mention of it at all. Help?

我正在使用 Python-requests 库来执行此操作.

I'm using Python-requests library to do this.

推荐答案

参考 listingcontroller.py (这里) :

    if (where in ('saved', 'hidden') and not 
        ((c.user_is_loggedin and c.user._id == vuser._id) or
          c.user_is_admin)):
        return self.abort403()

您可以清楚地看到,您必须以 username 或管理员身份登录才能获取 savedhidden 数据 -否则你会收到 403 错误.

you can clearly see that you must be logged in as username or be an admin in order to get the saved or hidden data - otherwise you get a 403 error.

这篇关于调用 Reddit API 时出现 403 错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆