I've been trying to learn python these past couple of days and I ran into a problem I'm not quite sure how to solve. I'm trying to make a simple reddit bot and learn the praw reddit API. When I run the following bot:
import praw
import time
r = praw.Reddit('testmachine11968986531')
test = r.submission(id="5u7q8x")
comment_user = set() # to avoid duplicates
for i in xrange(0,10): # Run the loop 10 times
#comments = r.comments(submission)
for comment in test.comments:
body = comment.body.lower()
if body.find("think") != -1 or body.find("please") != -1:
comment_user.add(comment.author)
#time.sleep(120) # Sleep for 2 minutes
print "Here are some comments:"
for user in polite_users:
print user
I get an error:
RequestException: error with request [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
I've poked around and saw I can insert something like
verify = False
in a get() instance of sorts, but I'm unsure if that would work in this particular example. Everything else works fine I believe -- I can use pip just fine, etc.
Any help would be appreciated. Thanks a ton.
edit: the full error traceback is
Traceback (most recent call last):
File "C:\Users\**\Desktop\Bottest\startBot.py", line 16, in <module>
for comment in test.comments:
File "C:\Python27\lib\site-packages\praw\models\reddit\base.py", line 31, in __getattr__
self._fetch()
File "C:\Python27\lib\site-packages\praw\models\reddit\submission.py", line 133, in _fetch
'sort': self.comment_sort})
File "C:\Python27\lib\site-packages\praw\reddit.py", line 320, in get
data = self.request('GET', path, params=params)
File "C:\Python27\lib\site-packages\praw\reddit.py", line 404, in request
params=params)
File "C:\Python27\lib\site-packages\prawcore\sessions.py", line 133, in request
self._authorizer.refresh()
File "C:\Python27\lib\site-packages\prawcore\auth.py", line 328, in refresh
password=self._password)
File "C:\Python27\lib\site-packages\prawcore\auth.py", line 138, in _request_token
response = self._authenticator._post(url, **data)
File "C:\Python27\lib\site-packages\prawcore\auth.py", line 29, in _post
data=sorted(data.items()))
File "C:\Python27\lib\site-packages\prawcore\requestor.py", line 48, in request
raise RequestException(exc, args, kwargs)
RequestException: error with request [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)