Hello,
I'm working on licensing for R19 and I'm getting an SSL error on Mac. The code works with Mac on R20 and greater. I've been working with @m_adam 's code from urllib2.urlopen fails on C4D for Mac. If I use https://www.google.com
as the URL, I get HTML as a response, but not when using the POST method to my online store's API: https://api.gumroad.com/v2/licenses/verify
(I'm also adding 'params' to this URL).
req = urllib2.Request(url,urlencode(params))
f = os.path.join(os.path.dirname(c4d.storage.GeGetStartupApplication()), "resource", "ssl", "cacert.pem")
dataString = urllib2.urlopen(req, cafile=f).read()
Result:
Traceback (most recent call last):
File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/urllib2.py", line 1240, in https_open
context=self._context)
File "/Applications/MAXON/Cinema 4D R19/resource/modules/python/Python.osx.framework/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:581)>
I've spent hours trying to fix this but haven't gotten anywhere. I've also tried using urllib.urlopen
, but I got the same TLSV1_ALERT_PROTOCOL_VERSION URLError.
context = ssl.create_default_context(cafile=f)
urllib.urlopen(req,context=context)
I've tried to find an online API to fully replicate this issue in a script, but most do not allow to POST without a key. The rest of my code works with R18 and higher so this is my last step before launching.
Can anyone from Maxon tell me what changed with the SSL or C4D's Python between R19 & R20 that might have caused this issue? Is there any way to fix it?
Thank you!