From 187617498a0dea17e51950f1ad5e96bb4826367d Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Sun, 26 Apr 2015 18:58:31 +0200 Subject: [PATCH] Log an error if the ndg-httpsclient, pyopenssl and pyasn1 packages are not installed. See #298 --- searx/webapp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/searx/webapp.py b/searx/webapp.py index 13c965e0..38780220 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -61,6 +61,16 @@ except: from sys import exit exit(1) +# check if the pyopenssl, ndg-httpsclient, pyasn1 packages are installed. +# They are needed for SSL connection without trouble, see #298 +try: + import OpenSSL.SSL # NOQA + import ndg.httpsclient # NOQA + import pyasn1 # NOQA +except ImportError: + logger.critical("The pyopenssl, ndg-httpsclient, pyasn1 packages have to be installed.\n" + "Some HTTPS connections will failed") + logger = logger.getChild('webapp')