HTTPS via urllib2 - Error

hi all,

I am trying to send an HTTPS GET request via a button-release script, but get an error which I don’t understand how to work around. I’ve tried looking online and on the forum with no success, except that it appears to be some issue with how Python handles the SSL certificates.

I’ve successfully tested the HTTPS GET request via the URL bar of Internet Explorer on the same machine, and can also successfully send GET requests to HTTP URLs via my script.

Ignition Version: 7.8.3
Operating System: Windows Server 2012


Import urllib2 f = urllib2.urlopen("someURL") print

When tested on a simple HTTP URL, the website contents appear in the Output Console.

When tested on HTTPS URLs, the following appears in the output console:

[code]Traceback (most recent call last):
File “event:mouseReleased”, line 2, in
File “C:\Users\ignition.ignition\cache\gw10.4.2.202_8088_8043_main\C0\pylib\”, line 124, in urlopen
return, data)
File “C:\Users\ignition.ignition\cache\gw10.4.2.202_8088_8043_main\C0\pylib\”, line 381, in open
response = self._open(req, data)
File “C:\Users\ignition.ignition\cache\gw10.4.2.202_8088_8043_main\C0\pylib\”, line 398, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File “C:\Users\ignition.ignition\cache\gw10.4.2.202_8088_8043_main\C0\pylib\”, line 360, in _call_chain
result = func(*args)
File “C:\Users\ignition.ignition\cache\gw10.4.2.202_8088_8043_main\C0\pylib\”, line 1126, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File “C:\Users\ignition.ignition\cache\gw10.4.2.202_8088_8043_main\C0\pylib\”, line 1093, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (-1, ‘SSL handshake exception: Differences between the SSL socket behaviour of cpython vs. jython are explained on the wiki:’)>

Ignition v7.8.3 (b2016061017)
Java: Oracle Corporation 1.8.0_92 [/code]

I guess I’m wondering, what’s going on here, and how can I make it work?

Thanks in advance for any responses.

Try using the scripting function. It has a boolean parameter for bypassing certificate validation, which may be the issue you’re having: … et.httpGet

hi Kevin,

thanks for your response. I’ve tried the “” function with partial success - another error has appeared when attempting to bypass the certificate validation. Does anyone know how to get around this, or could point me in the right direction?

  1. Using just the URL, or bypassCertValidation=1, it works. The first time it prompts that the certificate is not valid and isn’t trusted (I think because in this case the server owner issued their own certificate), with the option to proceed. After proceeding once the prompt does not occur until the designer is closed and launched again.

  2. Using bypassCertValidation=0 to this particular URL, the following error is produced:

[code]Traceback (most recent call last):
File “event:mouseReleased”, line 1, in
IOError: Certificates does not conform to algorithm constraints

at org.python.core.Py.fromIOException(
at org.python.core.Py.IOError(
at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.httpGet(
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(
at org.python.core.PyObject.__call__(
at org.python.pycode._pyx13.f$0(<event:mouseReleased>:6)
at org.python.pycode._pyx13.call_function(<event:mouseReleased>)
at org.python.core.Py.runCode(
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(
at com.sun.proxy.$Proxy28.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$ Source)
at java.awt.EventQueue$ Source)
at Method)
at$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$ Source)
at java.awt.EventQueue$ Source)
at Method)
at$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at Source)

Ignition v7.8.3 (b2016061017)
Java: Oracle Corporation 1.8.0_92[/code]

  1. However, using both bypassCertValidation=0 and 1 to some other randomly selected https site, “”, does not result in any prompts or errors. The contents are returned correctly in both cases.


Testing against “” produces the appropriate prompts when testing the certificate, and has no problems when not testing the certificate. IE, the website results are returned with no error.

I suppose this means that the problem is something strange at the server end. I’d appreciate any ideas on what that might be, but looks like it may not be an issue with Ignition.

Thanks in advance for any replies,



Did you figure what was the problem ? I have something similar here and cannot figure where is the problem ?


Have you resolved this problem? Could you give some help ?

You might consider using httplib instead, as:

import httplib
con = httplib.HTTPSConnection('host',443,context=ssl._create_unverified_context())
con.request('GET', '/url')
data = con.getresponse().read()

Somewhat painful, but this is the only built-in way to bypass all certificate checks in Python 2.

1 Like