0
votes

I've seen a couple of questions that already asked this but there were no responses, so I'll give it a try. When I use the following code:

import praw, time

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

I get a connection error that has the following traceback:

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

I have tried this from python 3.4 and 2.7, I've tried running from IDLE and from the terminal. I've tried leaving my username and password out and logging in when prompted. I've tried from my Mac in my hotel room and a Windows machine from work and I get the same error everytime. I've tried from my bot account that I just made and my normal account. Does anyone have any ideas?

1

1 Answers

0
votes

The issue was that I had the word 'bot' in my user_agent string. After it was removed, there were no problems.