mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-22 13:49:39 +08:00
Use certifi CA certs with urllib requests
CURA-6698
This commit is contained in:
parent
445fb59c12
commit
2ed5fd73bc
@ -8,6 +8,8 @@ import ssl
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
|
||||||
|
import certifi
|
||||||
|
|
||||||
|
|
||||||
class SliceInfoJob(Job):
|
class SliceInfoJob(Job):
|
||||||
def __init__(self, url, data):
|
def __init__(self, url, data):
|
||||||
@ -20,11 +22,14 @@ class SliceInfoJob(Job):
|
|||||||
Logger.log("e", "URL or DATA for sending slice info was not set!")
|
Logger.log("e", "URL or DATA for sending slice info was not set!")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Submit data
|
# CURA-6698 Create an SSL context and use certifi CA certificates for verification.
|
||||||
kwoptions = {"data" : self._data, "timeout" : 5}
|
context = ssl.SSLContext(protocol = ssl.PROTOCOL_TLSv1_2)
|
||||||
|
context.load_verify_locations(cafile = certifi.where())
|
||||||
|
|
||||||
if Platform.isOSX():
|
# Submit data
|
||||||
kwoptions["context"] = ssl._create_unverified_context()
|
kwoptions = {"data": self._data,
|
||||||
|
"timeout": 5,
|
||||||
|
"context": context}
|
||||||
|
|
||||||
Logger.log("i", "Sending anonymous slice info to [%s]...", self._url)
|
Logger.log("i", "Sending anonymous slice info to [%s]...", self._url)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user