URLError 10054 'Software connection abort'

I am trying to do a GET request with a Python script on a button script.
I have previously got it to work with a simpler API, but the new API i am needing to use required HMAC-SHA356 encoding.
I finally managed to get it to work, but have noticed a strange behaviour when running the script from different systems.

[ul]1) When i run the script from a Windows 7 Ignition 7.9 Server, it works fine.
2) When i run it through a designer on my laptop pointing to the Win7 server, it works fine.
3) When i run the script on a Debian Ignition 7.8 Server, it works fine.
4) When i run it through a designer on my local laptop (Windows 8.1) pointing to the Debian Ignition server, i get the following error:

[quote]urllib2.URLError: <urlopen error (10054, ‘Software caused connection abort’)>
I don’t quite understand why the same code can work in most instances except this one case. Is there some sort of communication issue without request timeouts when sending a request from a remote designer to the Gateway? My guess is that the Gateway is cancelling the request, but i really have no idea, its over my head.

The code i’m executing is:

[code]def updateProductsAPI():
This function reads all products from Unleashed via API call.
The API returns JSON data. The GUID is compared with those in the SQL table.
If a record exists in SQL, it is updated. Otherwise the new record is inserted.

import system
import urllib2
import hashlib
import base64
import hmac

# Generate URL for API call to read products
url = "https://api.unleashedsoftware.com/" + "Products?"
urlArgs = ""

# Encrypt signature using key	
apiID = "XXXX"

message = urlArgs.encode('utf-8')
secret = apiKEY.encode('utf-8')
signature = base64.b64encode(hmac.new(secret,message, digestmod=hashlib.sha256).digest())

# Create header with information required by API
urlHeader = {"Accept": "application/json", "api-auth-id": apiID, "api-auth-signature": signature, "Content-Type": "application/json"}

# Read in data from Unleashed API 
request = urllib2.Request(url, headers=urlHeader)
contents = urllib2.urlopen(request).read()
data = system.util.jsonDecode(contents)
print "Success!!"

event.source.Updating = 0

end def

“”" Start of main function “”"
event.source.Updating = 1

Not really sure what the issue is here.

But since moving away from ‘urllib2’ and using Ignitions ‘system.net.getHttp()’ method, I no longer get these errors.

Not sure what it could have been either.

What did you mean by sending a request from the remote designer to gateway? Where it executes depends on the scope you execute the script. Executing it in the client or designer does not send it to the gateway to run.

Ok i wasn’t sure how the global scripts were executed.

If both global scripts and local button scripts are both just executed in the operating system that the Desginer is running in, then i really don’t know whats going on.

Because there doesn’t seem to be a specific Operating system that throws the error, if you look back at the combinations i tried.