# Gateway Script httpGet CONNECTION RESET ERROR

**URL:** <https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365>\
**Category:** Ignition\
**Created:** [August 22, 2018, 7:12pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365 "2018-08-22T19:12:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:12pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/1 "2018-08-22T19:12:05Z")

</div>

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

```auto
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:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 22, 2018, 7:26pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/2 "2018-08-22T19:26:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:28pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/3 "2018-08-22T19:28:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:30pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/4 "2018-08-22T19:30:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 22, 2018, 7:33pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/5 "2018-08-22T19:33:20Z")

</div>

> [@christopher.panici](#):
>
> I was running the script on the gateway computer inside the script console. Same machine.

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

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:34pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/6 "2018-08-22T19:34:21Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 22, 2018, 7:39pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/7 "2018-08-22T19:39:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:42pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/8 "2018-08-22T19:42:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:47pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/9 "2018-08-22T19:47:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 22, 2018, 7:49pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/10 "2018-08-22T19:49:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:50pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/11 "2018-08-22T19:50:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 22, 2018, 7:52pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/12 "2018-08-22T19:52:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 7:53pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/13 "2018-08-22T19:53:29Z")

</div>

I found this interesting:

> [@Gateway Timer Script and httpGet Problem](http://forum.inductiveautomation.com/t/gateway-timer-script-and-httpget-problem/5229):
>
> I received the following error (IOError: Connection timed out: connect) when trying to execute the httpGet command from within the Gateway Event Scripts. As noted in other threads the scripts works fine from a button. I understand that the client side execution is different from the server side execution. Therefore, I ran a client instance (button test) on the gateway server machine and it works as well as verifying the URL is visible through Internet Explorer and disabled firewalls, so I do …

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 8:06pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/14 "2018-08-22T20:06:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 8:10pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/15 "2018-08-22T20:10:52Z")

</div>

Looks like that didn’t work.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 22, 2018, 8:24pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/16 "2018-08-22T20:24:57Z")

</div>

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

> [@Gateway Timer Script and httpGet Problem](http://forum.inductiveautomation.com/t/gateway-timer-script-and-httpget-problem/5229/6):
>
> I may have figured it out, looks like a proxy issue… I placed the following two lines in ignition.conf and am getting expected behavior. I will have to perform additional steps to verify. Thanks for the support! wrapper.java.additional.8=-Dhttp.proxyHost=xx.xx.xx.xx wrapper.java.additional.9=-Dhttp.proxyPort=80

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 8:28pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/17 "2018-08-22T20:28:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 22, 2018, 8:31pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/18 "2018-08-22T20:31:59Z")

</div>

Here is where mine sits:

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

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 8:38pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/19 "2018-08-22T20:38:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![christopher.panici](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/christopher.panici/32/5814_2.png) [@christopher.panici](https://forum.inductiveautomation.com/u/christopher.panici)\
**Post date:** [August 22, 2018, 8:50pm UTC](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365/20 "2018-08-22T20:50:31Z")

</div>

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.

[Next page](https://forum.inductiveautomation.com/t/gateway-script-httpget-connection-reset-error/19365.md?page=2)
