|
11 | 11 | import platform |
12 | 12 | from datetime import datetime, timezone |
13 | 13 | import dateutil.parser |
14 | | -import ssl |
| 14 | +import truststore |
15 | 15 | from enum import Enum, auto |
16 | 16 | import re |
17 | 17 | import typing |
|
71 | 71 | ) |
72 | 72 | from .version import __version__ |
73 | 73 |
|
74 | | -this_dir = os.path.dirname(os.path.realpath(__file__)) |
| 74 | +truststore.inject_into_ssl() |
| 75 | + |
75 | 76 | json_headers = {"Content-Type": "application/json"} |
76 | 77 |
|
77 | 78 |
|
@@ -180,21 +181,7 @@ def __init__( |
180 | 181 | else: |
181 | 182 | handlers.append(urllib.request.ProxyHandler({"https": f"{proxy_url}:{proxy_config['port']}"})) |
182 | 183 |
|
183 | | - # fix for wrong macos installation of python certificates, |
184 | | - # see https://github.com/lutraconsulting/qgis-mergin-plugin/issues/70 |
185 | | - # remove when https://github.com/qgis/QGIS-Mac-Packager/issues/32 |
186 | | - # is fixed. |
187 | | - default_capath = ssl.get_default_verify_paths().openssl_capath |
188 | | - if os.path.exists(default_capath): |
189 | | - self.opener = urllib.request.build_opener(*handlers, urllib.request.HTTPSHandler()) |
190 | | - else: |
191 | | - cafile = os.path.join(this_dir, "cert.pem") |
192 | | - if not os.path.exists(cafile): |
193 | | - raise Exception("missing " + cafile) |
194 | | - ctx = ssl.SSLContext() |
195 | | - ctx.load_verify_locations(cafile) |
196 | | - https_handler = urllib.request.HTTPSHandler(context=ctx) |
197 | | - self.opener = urllib.request.build_opener(*handlers, https_handler) |
| 184 | + self.opener = urllib.request.build_opener(*handlers, urllib.request.HTTPSHandler()) |
198 | 185 | urllib.request.install_opener(self.opener) |
199 | 186 |
|
200 | 187 | if login and not password: |
|
0 commit comments