system.net.httpGet() Caching Data?

Hey all,

I have a little news display on my system that gets an RSS feed from Google and displays it in the client. The code uses system.net.httpGet() to get the rss feed and parse it out. For a long time the news feed would never change and I didn’t have any time to look into it. Today I finally spent some time and looked into it.

From my testing I have found that somehow, I have no idea how, the system.net.httpGet() function is caching data somewhere from months ago. If I run it in the script console the printed data is different than if I would type in the same URL in my browser. The data returned from system.net.httpGet() is several months old.

However, if I put a different URL in the function then it would return correctly until I put the original RSS feed URL back in there. It seems like the function is caching on specific URLs! Not sure if this was an attempt to speed up the function or what but it’s causing issues.

For now I have switched the function to the Python equivalent:

response = urllib2.urlopen(url).read().encode("ascii", "ignore")

That seems to work without issue. FYI for anyone else using the system.net.httpGet() function and has that issue.

In some recent versions the system.net.httpGet function got a “useCaches” parameter that you can set to false to avoid this.

Well… that worked.

It would sure be nice if that was in the documentation. Would have saved me a couple of hours as that was the first place that I looked.

Yep, sending this over to the training/doc team.

I’d just like to pitch in and say i had this issue too. Was driving me insane wondering why my GET’s were returning old data.

Adding useCaches=False worked for me!! :prayer:

And sadly i’ve been using the Ignition 7.8 Manual most of the time, so I did not see it as a parameter. Will make sure to reference the 7.9 documentation from now on!