使用praw登录reddit时出错

时间:2015-01-22 02:10:37

标签: python reddit praw

我已经看过几个已经问过这个但没有回复的问题,所以我试试看。当我使用以下代码时:

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,我每次都会遇到同样的错误。我已经从我刚刚制作的机器人帐户和我的普通帐户进行了尝试。有没有人有任何想法?

1 个答案:

答案 0 :(得分:0)

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