I'm creating a private Shopify app, that uses basic authentication. The program is to be written in IronPython, however, I'm having trouble getting urllib2 working.
I've tried the solution from here: Python urllib2 Basic Auth Problem
and it works as expected with plain python, but when run with IronPython, I get this error:
IOError: System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value) at DLRCachedCode.do_open$5398(Closure , PythonFunction $function, Object self, Object http_class, Object req) at IronPython.Runtime.FunctionCaller`3.Call3(CallSite site, CodeContext context, Object func, T0 arg0, T1 arg1, T2 ar...
I tried an all .NET solution in IronPython (not using urllib2) and it works, using this method: http://www.ironpython.info/index.php?title=Fetching_a_Page_with_Basic_Authentication
Is there some magic going on behind the scenes (python -> .NET) causing this not to work?