Python mechanize or any other library to login into google to read groups
Question: I am trying to read google groups so it is expecting to login into google
account.

I used Mechanize for that but I am getting SSL verification error

    
    
    from mechanize import Browse
    br=Browse()
    br.set_handle_equiv(True)
    br.set_handle_gzip(True)
    br.set_handle_redirect(True)
    br.set_handle_refresh(False)  
    br.set_handle_referer(True)
    br.set_handle_robots(False)
    br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
    
    
    br.open("https groups login url") now here it hits the SSL verification error.(“SSL: CERTIFICATE_VERIFY_FAILED” Error)
    

  1. is there anyway to avoid SSL verification issue?
  2. is there any library that I can use?

Note: I tried with UrlLib2 I am able to set empty SSL context and able to
avoid this SSL certificate issue but handling login is big issue so I am
trying to use some browser behavior module.


Answer: See ["SSL: CERTIFICATE_VERIFY_FAILED"
Error](http://stackoverflow.com/questions/27835619/ssl-certificate-verify-
failed-error/27847883) for further explanation, but here's the quick fix:

    
    
    import ssl
    
    ssl._create_default_https_context = ssl._create_unverified_context
    

