I have not tried running native Python on the server, only from my workstation so that is probably why VSCode Python succeeds vs. the service account that is running Ignition.
I agree; wireshark would be helpful and the IT dept. knows it would help but the project is too low of a priority for them / not worth their time so they won’t allow installing wireshark on the server.
I have another version of code based on what I found here:
Webservices NTLM Auth - General Discussion - Inductive Automation Forum
This version returns a PKIX certificate error.
The needed certificates are in the …\Certificates\Supplemental folder, downloaded from the web site hosting the API and confirmed by their developers.
def useApacheLibs(username, password):
from org.apache.http.auth import AuthScope
from org.apache.http.auth import NTCredentials
from org.apache.http.client.methods import HttpGet
from org.apache.http.client.methods import HttpPost
from org.apache.http.impl.client import DefaultHttpClient
from org.apache.http.impl.client import BasicResponseHandler
from org.apache.http.entity import ContentType
from java.io import ByteArrayOutputStream
# Setup the client with NTLM Auth
httpclient = DefaultHttpClient()
print 'httpclient={}'.format(httpclient)
# Define the credentials to use
creds = NTCredentials(username, password, system.net.getHostName(), "myDomain")
httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds)
print 'creds={}'.format(creds)
print 'httpclient={}'.format(httpclient)
# Define the host and URL to call
getAppInfoUrl = '{}/GetAppInfo'.format(baseUrl)
print 'getAppInfoUrl={}'.format(getAppInfoUrl)
httpget = HttpGet(getAppInfoUrl)
print 'httpget={}'.format(httpget)
# Execute the request
response = httpclient.execute(httpget)
print 'response={}'.format(response)
return response
Printed info looks good up to the execute statement where it blows up with PKIX error.