ITADN

Removal Reasons can't be iterated (403 Forbidden)

#2054Closedfrankiwilson 创建于 2025-02-18
F
frankiwilsoncommented
### Describe the Bug This may be a Reddit issue and not an issue with PRAW, but I'm having trouble nailing that down. When I attempt to iterate over removal reasons, I'm getting a 403 from Reddit. ### Desired Result Get a list of removal reasons ### Code to reproduce the bug ```Python import praw # reddit initialization for removal_reason in reddit.subreddit("SUB_NAME").mod.removal_reasons: print(removal_reason) ``` ### My code does not include sensitive credentials - [x] Yes, I have removed sensitive credentials from my code. ### Relevant Logs ```Shell Traceback (most recent call last): File "c:\Users\user\source\repos\ProjectName\PRAW\.venv\test.py", line 42, in <module> for removal_reason in reddit.subreddit("BWPNWTest").mod.removal_reasons: File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\models\reddit\removal_reasons.py", line 232, in __iter__ return iter(self._removal_reason_list) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\util\cache.py", line 39, in __get__ value = obj.__dict__[self.func.__name__] = self.func(obj) ^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\models\reddit\removal_reasons.py", line 154, in _removal_reason_list response = self._reddit.get( ^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\util\deprecate_args.py", line 46, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\reddit.py", line 731, in get return self._objectify_request(method="GET", params=params, path=path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\reddit.py", line 514, in _objectify_request self.request( File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\util\deprecate_args.py", line 46, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\praw\reddit.py", line 963, in request return self._core.request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\prawcore\sessions.py", line 328, in request return self._request_with_retries( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\source\repos\ProjectName\PRAW\.venv\Lib\site-packages\prawcore\sessions.py", line 267, in _request_with_retries raise self.STATUS_EXCEPTIONS[response.status_code](response) prawcore.exceptions.InsufficientScope: received 403 HTTP response ``` ### This code has previously worked as intended I'm not sure, I haven't used this code before. ### Operating System/Environment Windows 11 ### Python Version 3.11.4 ### PRAW Version 7.8.1 ### Links, references, and/or additional comments? I suspect this is actually an issue with the Reddit API because I'm getting the same 403 when I call it from Postman.
关闭于 2025-02-18 10 条评论