Forums

PRAW "Connection Refused"

I'm trying to use PRAW 2.1.3 to log into Reddit. Having just installed it, I get a "Connection Refused" error when trying to log in:

r = praw.Reddit(user_agent="test user agent") r.login(username=USERNAME, password=PASSWORD)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/sotb3/.local/lib/python2.7/site-packages/praw/init.py", line 1120, in login self.request_json(self.config['login'], data=data) File "/home/sotb3/.local/lib/python2.7/site-packages/praw/decorators.py", line 95, in wrapped return_value = function(reddit_session, args, kwargs) File "/home/sotb3/.local/lib/python2.7/site-packages/praw/init.py", line 469, in request_json response = self._request(url, params, data) File "/home/sotb3/.local/lib/python2.7/site-packages/praw/init.py", line 342, in _request response = handle_redirect() File "/home/sotb3/.local/lib/python2.7/site-packages/praw/init.py", line 315, in handle_redirect timeout=timeout, kwargs) File "/home/sotb3/.local/lib/python2.7/site-packages/praw/handlers.py", line 135, in wrapped result = function(cls, kwargs) File "/home/sotb3/.local/lib/python2.7/site-packages/praw/handlers.py", line 54, in wrapped return function(cls, kwargs) File "/home/sotb3/.local/lib/python2.7/site-packages/praw/handlers.py", line 90, in request allow_redirects=False) File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 460, in send r = adapter.send(request, *kwargs) File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 246, in send raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ssl.reddit.com', port=443): Max retries exceeded with url: /api/login/.json (Caused by <class 'so cket.error'>: [Errno 111] Connection refused)

I saw some references in past comments to this perhaps being a "proxy issue" - I don't know what that means, but maybe that's it?

Interestingly, at first I was having similar trouble when trying to run "easy_install praw" or "pip install praw" (it would say something similar to "[Errno 111] Connection refused" when trying to connect to pypi.python.org to retrieve the package). However, the installation command (with pip) inexplicably worked after I tried it again later. Also, I was able to log into Reddit exactly once, using an older version of PRAW, although it had failed just before and continued to fail just afterward (and I haven't gotten so lucky since).

Thanks for your help

Hi sotb3,

Free users have restricted internet access. It's the only way to prevent abuse. Reddit is included in our list of whitelisted sites. So you should be able to make a basic http connection to the site. But you may not be able to make a https connection. You can upgrade to a paid account and test it out. We do offer a 30 day refund so there is no risk.