Browse Source

Force certificates

Arkadiusz Ryś 2 years ago
parent
commit
c7e28e636e

+ 8 - 0
graph_exploring_tool/graphical/query_group.py

@@ -1,5 +1,6 @@
 import enum
 import logging
+import ssl
 import urllib
 from itertools import groupby
 from typing import List, Union, Optional
@@ -228,6 +229,13 @@ def _perform_query(sender: int, mode: str, user_data: Optional[dict]):
         logging.exception(e)
         set_status_text(f"Connection to '{endpoint}' failed.", StatusMessageType.ERROR)
         return
+    except ssl.SSLCertVerificationError:
+        import certifi
+        logging.error("Certificate error.")
+        logging.error("Please make sure you have intermediate certificates installed.")
+        logging.error(certifi.where())
+        set_status_text(f"Please make sure you have intermediate certificates installed. \n{certifi.where()}", StatusMessageType.ERROR)
+        return
     if use_post_method:
         logging.debug(f"{query_result}")
         if query_result:

+ 4 - 0
graph_exploring_tool/query.py

@@ -1,4 +1,6 @@
 import json.decoder
+import logging
+import ssl
 from dataclasses import dataclass, field
 from typing import List
 from urllib.error import URLError
@@ -86,4 +88,6 @@ def perform_query(endpoint_uri: str, query_text: str, post: bool = False) -> dic
         raise
     except json.decoder.JSONDecodeError:
         raise
+    except ssl.SSLCertVerificationError:
+        raise
     return result.as_json()

+ 3 - 3
pyproject.toml

@@ -20,7 +20,7 @@ dynamic = ["version", "description"]
 license = {file = "LICENSE"}
 keywords = ["graph"]
 dependencies = [
-    "owly~=0.0.2",
+    "owly~=0.0.3",
     "toml~=0.10.2",
     "arklog~=0.5.1",
     "dacite~=1.8.1",
@@ -33,7 +33,7 @@ test = [
     "pytest~=7.4.0",
 ]
 doc = [
-    "sphinx~=7.1.0",
+    "sphinx~=7.1.1",
 ]
 dev = [
     "tox~=4.6.4",
@@ -42,7 +42,7 @@ dev = [
     "twine~=4.0.2",
     "invoke~=2.2.0",
     "jinja2~=3.1.2",
-    "flake8~=6.0.0",
+    "flake8~=6.1.0",
     "coverage~=7.2.7",
     "pyinstaller~=5.13.0",
     "pyinstaller-hooks-contrib~=2023.6",

+ 3 - 3
requirements.txt

@@ -1,5 +1,5 @@
 # Graph Exploring Tool
-owly    ~= 0.0.2
+owly    ~= 0.0.3
 toml    ~= 0.10.2
 arklog  ~= 0.5.1
 dacite  ~= 1.8.1
@@ -8,7 +8,7 @@ certifi ~= 2023.7.22
 # Test
 pytest ~= 7.4.0
 # Doc
-sphinx ~= 7.1.0
+sphinx ~= 7.1.1
 # Dev
 tox         ~= 4.6.4
 pip         ~= 23.2.1
@@ -16,7 +16,7 @@ flit        ~= 3.9.0
 twine       ~= 4.0.2
 invoke      ~= 2.2.0
 jinja2      ~= 3.1.2
-flake8      ~= 6.0.0
+flake8      ~= 6.1.0
 coverage    ~= 7.2.7
 pyinstaller ~= 5.13.0
 pyinstaller-hooks-contrib ~= 2023.6