Skip to content

Commit

Permalink
AddonManager: Introduced SSL fix discussed on FreeCAD-addon issue #11
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed May 25, 2017
1 parent 335da6a commit b604b27
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Mod/AddonManager/AddonManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import urllib2
else:
import urllib.request as urllib2
import ssl
ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)

NOGIT = False # for debugging purposes, set this to True to always use http downloads

Expand Down Expand Up @@ -307,7 +309,7 @@ def __init__(self):
def run(self):
"populates the list of addons"
self.progressbar_show.emit(True)
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons")
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons",context=ctx)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -351,7 +353,7 @@ def run(self):
i = 0
for repo in self.repos:
url = repo[1]
u = urllib2.urlopen(url)
u = urllib2.urlopen(url,context=ctx)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -381,7 +383,7 @@ def run(self):
self.info_label.emit("Downloading list of macros...")
self.progressbar_show.emit(True)
macropath = FreeCAD.ParamGet('User parameter:BaseApp/Preferences/Macro').GetString("MacroPath",os.path.join(FreeCAD.ConfigGet("UserAppData"),"Macro"))
u = urllib2.urlopen("http://www.freecadweb.org/wiki/Macros_recipes")
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes",context=ctx)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -423,7 +425,7 @@ def run(self):
else:
url = self.repos[self.idx][1]
self.info_label.emit(translate("AddonsInstaller", "Retrieving info from ") + str(url))
u = urllib2.urlopen(url)
u = urllib2.urlopen(url,context=ctx)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -465,9 +467,9 @@ def run(self):
mac = self.macros[self.idx][0].replace(" ","_")
mac = mac.replace("&","%26")
mac = mac.replace("+","%2B")
url = "http://www.freecadweb.org/wiki/Macro_"+mac
url = "https://www.freecadweb.org/wiki/Macro_"+mac
self.info_label.emit("Retrieving info from " + str(url))
u = urllib2.urlopen(url)
u = urllib2.urlopen(url,context=ctx)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down

0 comments on commit b604b27

Please sign in to comment.