# Help: Posting from Gateway Tag Change/Event to Webhook?

**URL:** <https://forum.inductiveautomation.com/t/help-posting-from-gateway-tag-change-event-to-webhook/90399>\
**Category:** Ignition\
**Created:** [May 15, 2024, 3:02am UTC](https://forum.inductiveautomation.com/t/help-posting-from-gateway-tag-change-event-to-webhook/90399 "2024-05-15T03:02:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 15, 2024, 12:49pm UTC](https://forum.inductiveautomation.com/t/help-posting-from-gateway-tag-change-event-to-webhook/90399/2 "2024-05-15T12:49:32Z")

</div>

Good morning KB, welcome to the forum.

And **great** first post. You are on the right track, I think. But some items to change to ensure you get good diagnostics:

- Move your creation of your httpClient outside the function. The client object is designed to be re-used, and can cause memory leaks if you keep making more of them. Like so:

```python
# ....
client = system.net.httpClient()

def postTagChangeData(event):
# ....

```

- In your event, remove the import `from dataPublisher`. Never import from project library scripts. They auto-load when referenced, so the event script should be a one-liner:

```python
dataPublisher.postTagChangeData(event)

```

- Your `except` clause calls out jython's `Exception`, which **does not** catch java exceptions. Different inheritance hierarchy. I recommend using **two** clauses, and making the jython exceptions more logger-friendly. You need java's `Throwable` class in your imports, like so:

```python
from java.lang import Throwable

```

Then your catch clauses should look like this:

```python
    except Throwable as t:
        # Log any exceptions that occur
        logger.error("Java Error sending data to Losant", t)
    except Exception as e:
        # Log any exceptions that occur
        logger.error("Jython Error sending data to Losant", later.PythonAsJavaException(e))

```

Notice that java loggers accept `Throwable` last arguments and will place the full backtrace in your logs. Place my [later.py](https://www.automation-pros.com/ignition/later.py) script in your project library to have the wrapper that converts jython exceptions into java logger-compatible exceptions.

With this last change, the real problem will likely be logged.

Side note: If you are feeling brave, you can try the new, more capable, exception wrapper I posted yesterday:

> [@Automation Professionals' Integration Toolkit Module](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934/122):
>
> Automation Professionals is pleased to announce a beta release of this Integration Toolkit: For Ignition v8.1+, as usual: [v2.0.16.241352008](https://www.automation-pros.com/ignition/Integration%20Toolkit-2.0.16.241352008-v81.modl) This beta introduces a number of new scripting features: Inspired by @Mathias_Melling above, the souped-up dictionary functionality of the BindableVarMap data type has been factored out, as [system.util.VarMap](https://www.automation-pros.com/toolkit/doc/scripting.html#varmap). Serializable to the extent its contents are serializable, just like dictionaries, and safe for use with persistence. grin The PythonAsJavaE…

---

_[View the full topic](https://forum.inductiveautomation.com/t/help-posting-from-gateway-tag-change-event-to-webhook/90399)._
