Pārlūkot izejas kodu

Log an error if the ndg-httpsclient, pyopenssl and pyasn1 packages are not installed.

Alexandre Flament 10 gadus atpakaļ
vecāks
revīzija
187617498a
1 mainītis faili ar 10 papildinājumiem un 0 dzēšanām
  1. 10
    0
      searx/webapp.py

+ 10
- 0
searx/webapp.py Parādīt failu

@@ -61,6 +61,16 @@ except:
61 61
     from sys import exit
62 62
     exit(1)
63 63
 
64
+# check if the pyopenssl, ndg-httpsclient, pyasn1 packages are installed.
65
+# They are needed for SSL connection without trouble, see #298
66
+try:
67
+    import OpenSSL.SSL  # NOQA
68
+    import ndg.httpsclient  # NOQA
69
+    import pyasn1  # NOQA
70
+except ImportError:
71
+    logger.critical("The pyopenssl, ndg-httpsclient, pyasn1 packages have to be installed.\n"
72
+                    "Some HTTPS connections will failed")
73
+
64 74
 
65 75
 logger = logger.getChild('webapp')
66 76