Using Youtube's Python API ProgrammaticLogin() gives SSL Error Python 2.7.9

226 views Asked by At

Edit: Turns out I'm an idiot and can't read something I already looked up, but the fix was to brew uninstall openssl then rm -rf /usr/local/openssl and then run brew install openssl there's an issue with openssl installed before OS X 10.10.3 and reinstalling it fixes it.

I'm trying to create a reddit bot that searches specified users on youtube, and submits their posts to a subreddit. When it tries to log in it gives an SSL error.

I'm on Python 2.7.9, and installed the gdata through pip.

Here's my code:

import gdata.youtube
import gdata.youtube.service
import praw


def main():
    yt_service = gdata.youtube.service.YouTubeService()
    yt_service.ssl = True
    yt_service.email = ''
    yt_service.password = ''
    yt_service.source = 'reddit-youtube-submitter-bot'
    yt_service.ProgrammaticLogin()

if __name__ == "__main__":
    main()

Here's the error:

Traceback (most recent call last):
  File "youtube_submitter_bot_mine.py", line 15, in <module>
    main()
  File "youtube_submitter_bot_mine.py", line 12, in main
    yt_service.ProgrammaticLogin()
  File "/usr/local/lib/python2.7/site-packages/gdata/service.py", line 771, in ProgrammaticLogin
    headers={'Content-Type':'application/x-www-form-urlencoded'})
  File "/usr/local/lib/python2.7/site-packages/atom/http.py", line 163, in request
    connection.endheaders()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 997, in endheaders
    self._send_output(message_body)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 850, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 812, in send
    self.connect()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1212, in connect
    server_hostname=server_hostname)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 350, in wrap_socket
    _context=self)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 566, in __init__
    self.do_handshake()
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 788, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
0

There are 0 answers