Gateway Script httpGet CONNECTION RESET ERROR

I am running the following script. It is not executing and gets this error every time. However, when I run the thing in the script console it works. Any ideas?

Script

import time
system.util.getLogger('CurrentWeather').info("Executing gateway script CurrentWeather...")
api_key = "<OMITTED>"
city_id = <OMITTED>
url = "https://api.openweathermap.org/data/2.5/weather?id=%s&units=imperial&appid=%s" % (city_id, api_key)

# gets the url response
response = system.net.httpGet(url)
response_object = system.util.jsonDecode(response)
# gets the temperature
temp = response_object["main"]["temp"]
humidity = response_object["main"]["humidity"]
pressure = response_object["main"]["pressure"]
temp_min = response_object["main"]["temp_min"]
temp_max = response_object["main"]["temp_max"]

visibility = response_object["visibility"]
wind_speed = response_object["wind"]["speed"]
wind_degree = response_object["wind"]["deg"]

sunrise_utc_timestamp = response_object["sys"]["sunrise"]
sunset_utc_timestamp = response_object["sys"]["sunset"]

sunrise = project.Utilities.convert_timestamp(sunrise_utc_timestamp)
sunset = project.Utilities.convert_timestamp(sunset_utc_timestamp)
					
#print("temp = %s, humidity = %s" % (temp, humidity))
# save the values into the memory tag
w = system.tag.write("CurrentWeather/Updated", system.date.now())
w1 = system.tag.write("CurrentWeather/Temperature", temp)
w2 = system.tag.write("CurrentWeather/Humidity", humidity)
w3 = system.tag.write("CurrentWeather/Pressure", pressure)
w4 = system.tag.write("CurrentWeather/TempMin", temp_min)
w5 = system.tag.write("CurrentWeather/TempMax", temp_max)
w6 = system.tag.write("CurrentWeather/Visibility", visibility)
w7 = system.tag.write("CurrentWeather/WindSpeed", wind_speed)
w8 = system.tag.write("CurrentWeather/WindDegree", wind_degree)
w9 = system.tag.write("CurrentWeather/Sunrise", sunrise)
w10 = system.tag.write("CurrentWeather/Sunset", sunset)
system.util.getLogger('CurrentWeather').info("CurrentWeather...done.")

Here is the error that I get - Line 25 is the httpGet call:

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 25, in IOError: Connection reset

at org.python.core.Py.fromIOException(Py.java:215)

at org.python.core.Py.IOError(Py.java:178)

at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.httpGet(AbstractNetUtilities.java:256)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)

at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:431)

at org.python.core.PyObject.__call__(PyObject.java:387)

at org.python.core.PyObject.__call__(PyObject.java:391)

at org.python.pycode._pyx2.f$0(:57)

at org.python.pycode._pyx2.call_function()

at org.python.core.PyTableCode.call(PyTableCode.java:165)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1275)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:636)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:603)

at com.inductiveautomation.ignition.common.script.TimerScriptTask.run(TimerScriptTask.java:88)

at java.util.TimerThread.mainLoop(Timer.java:555)

at java.util.TimerThread.run(Timer.java:505)

Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 25, in IOError: Connection reset

... 21 common frames omitted

In what context are you trying to run the script?

When you run it in the script console you’re running it on your computer under the user you’re logged in as.

If you’re running in the gateway scope, it’s running on the gateway as the user the Ignition service is running as.

If this is the case, there may be AV or some permissions problem causing the Connection reset error you’re seeing.

I was running the script on the gateway computer inside the script console. Same machine.

I should note that I am still running the trial version of Ignition; that shouldn’t matter though, right?

Same machine, different user. Trial version shouldn't make a difference.

Is there a built in user for the gateway? It is just an httpGet…it’s not like I am changing OS registry values here…

If it’s installed on Windows then by default it’s running as the ‘LocalService’ user (I think… this is a Windows thing and I’m not really a Windows guy). This is known to cause other weird issues too, like the inability to access network drives without explicitly mapping them.

Not certain this is your issue, just a possibility.

You’re probably right about it being a permissions issue, however, how can I modify my gateway OS to allow it to access this url? That is the real question?

I guess, why does the script console run the script as a different user? Shouldn’t it be the same built in gateway “user”?

No… the script console is running in the Designer, which you launched as your user.

So how do I fix this so it runs on the gateway? With your logic, what are the restrictions on what gateway scripts can do?

To execute in the gateway scope you would run it in a tag change script, timer script, or something else that executes on the gateway.

There’s no console or playground for executing in gateway scope.

There aren’t any intentional restrictions within Ignition either. Something external to Ignition is closing down this connection.

I found this interesting:

To test, I am now running the ignition gateway service as an administrative account.

Looks like that didn’t work.

In that other thread, running as an administrator didn't work, either. Did you try the proxy settings as described at the bottom?

I was going to, but I can’t find the ignition.conf file…did it move with a newer version?

Here is where mine sits:

C:\Program Files\Inductive Automation\Ignition\data

Found it, now adding the lines in the config file- hopefully it helps.

I have rested that this is an IT problem and I have taken it as far as I can…I hate to do this but 1-800-HELP-DESK.