Script Caching, or Python Caching - or Connection not getting flushed?

I have a project that I’m working on to snag some settings out of cameras that we have on the network.

I’ve been trying to work with the python ONVIF library and long story short - it only takes the initial connection info that I feed to it. It won’t change anything about the connection until I shutdown the client (or designer) and load it back up.

The ONVIF library uses suds to deal with the ONVIF SOAP API. Looking thru the forums nobody seems to like suds - but since I’m not in a place to spend $3500 on a module, and we’re stuck with Python 2 I haven’t come across any better options.

I’ve gone as deep into the source as I know to make sure there’s no caching going on. But at this point I don’t know what I don’t know and I’m kinda stuck - any ideas would be appreciated!

  • used pip to install onvif into the library:
    pip2 install --target=/usr/local/bin/ignition/user-lib/pylib onvif

created a script in the project library:
def checkDevice(ipAddress, username = 'ADMIN', password = '1234'):
port = 8000
mycam = ONVIFCamera(ipAddress, port, username, password)
resp = mycam.devicemgmt.GetDeviceInformation()
print 'My cameras Manufacturer: ’ + str(resp.Manufacturer) print 'My cameras Model: ' + str(resp.Model)
except Exception as e:
print str(e)
except Exception as e:
print str(e)

Calling the script
gives me a good response

calling it a second time - changing the username or password
camera.checkDevice(ipAddress, 'ADMIN', 'BadPassword')
Still gives me a good response

If I restart the designer or client and then run it the other way with the bad password first, I’ll get a “400 Bad Request” error (which is fine), but then correcting it to the right password will continue to give me that error.

Sorry if this is way out of scope - just not sure how to check what’s not getting updated.

– Steve

I can only imagine it’s something in the library, not any kind of script caching. You can add a print statement that logs the credentials you’re using to convince yourself that a different script is running each time you change it.

Kevin - Thanks for the reply. Your response + stepping away for a few hours shook lose putting print statements in the imported libraries for debugging.

(I think) I’ve tracked it down to the ONVIF library re-using it’s suds connection and not updating some of the options.
It’ll probably be an ugly hack job for someone to come back to later, but It should be worked out now.

Thanks again!