0

我已经看到几个问题已经问过这个问题但没有任何回应,所以我会试一试。当我使用以下代码时:

import praw, time

r = praw.Reddit(user_agent="Bot experiment by redacted")
r.login('redacted', 'redacted')

我收到具有以下回溯的连接错误:

Traceback (most recent call last):
  File "redacted", line 5, in <module>
    r.login('redacted', 'redacted')
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/praw/__init__.py", line 1263, in login
    self.request_json(self.config['login'], data=data)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/praw/decorators.py", line 161, in wrapped
    return_value = function(reddit_session, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/praw/__init__.py", line 519, in request_json
    response = self._request(url, params, data)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/praw/__init__.py", line 383, in _request
    _raise_response_exceptions(response)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/praw/internal.py", line 172, in _raise_response_exceptions
    response.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/models.py", line 831, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden

我已经从 python 3.4 和 2.7 尝试过这个,我尝试过从 IDLE 和终端运行。我尝试将我的用户名和密码留在外面,并在出现提示时登录。我已经在酒店房间的 Mac 和工作中的 Windows 机器上尝试过,但每次都遇到相同的错误。我已经尝试过我刚刚创建的机器人帐户和我的普通帐户。有没有人有任何想法?

4

1 回答 1

0

问题是我的 user_agent 字符串中有“bot”这个词。删除后,没有任何问题。

于 2015-01-27T04:56:20.320 回答