# \[Python Plugin\] - Get origin information (CalledAet, RemoteIp)

**URL:** https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045
**Category:** General
**Created:** [November 8, 2023, 7:56pm UTC](https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045 "2023-11-08T19:56:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gacou54](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@gacou54](https://discourse.orthanc-server.org/u/gacou54)
#### Post date: [November 8, 2023, 7:56pm UTC](https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045/1 "2023-11-08T19:56:39Z")

</div>

Hi,

I was wondering if it is possible to get the origin information (e.g. `CalledAet`, `RemoteIp`). when using the Python Plugin (I tried with `orthanc.RegisterIncomingCStoreInstanceFilter()`).

An “equivalent” is possible in lua:

```lua
function ReceivedInstanceFilter(dicom, origin, info)
  PrintRecursive(origin)
end

```

Result:

```auto
table
  [RemoteAet], string, ORTHANC2
  [CalledAet], string, MY_AET
  [RequestOrigin], string, DicomProtocol
  [RemoteIp], string, 127.0.0.1

```

However, it seems that the `orthanc.GetInstanceOrigin()` only returns an enum.

Thanks!  
Gabriel

---

<div class="post-metadata">

### Author: ![gacou54](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@gacou54](https://discourse.orthanc-server.org/u/gacou54)
#### Post date: [November 9, 2023, 3:04pm UTC](https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045/2 "2023-11-09T15:04:11Z")

</div>

Actually I think I found my answer here [Filtering incoming dicom instances using metadata (with python plugin) - #2 by Alain\_Mazy1](https://discourse.orthanc-server.org/t/filtering-incoming-dicom-instances-using-metadata-with-python-plugin/2624/2)

My understanding is that the information is accessible with `GetInstanceMetadata()` after the instance has been stored, which is something I would like to avoid. I will stay with lua then.

Follow up question: do you think it would be possible to change the `orthanc.InstanceOrigin` enum for an object similar to the `origin` table in lua for the Python Plugin?

Thanks!  
Gabriel

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [November 14, 2023, 2:20pm UTC](https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045/3 "2023-11-14T14:20:13Z")

</div>

> [@gacou54](#):
>
> change the `orthanc.InstanceOrigin` enum for an object similar to the `origin` table in lua for the Python Plugin?

I have [just added it](https://orthanc.uclouvain.be/hg/orthanc-python/rev/1ce48763e75b) in the list of possible improvements for the future.

Best regards,

Alain

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [August 20, 2026, 3:42pm UTC](https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045/4 "2026-08-20T15:42:03Z")

</div>

A few years later, this has now been implemented (but not released yet).  
See this [message for more information](https://discourse.orthanc-server.org/t/feature-request-expose-the-called-aet-to-the-incoming-c-store-instance-filter/6471/4).

---

<div class="post-metadata">

### Author: ![gacou54](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@gacou54](https://discourse.orthanc-server.org/u/gacou54)
#### Post date: [August 20, 2026, 5:03pm UTC](https://discourse.orthanc-server.org/t/python-plugin-get-origin-information-calledaet-remoteip/4045/5 "2026-08-20T17:03:50Z")

</div>

Excellent! Thank you very much. I actually need to do a pyorthanc update (I’m a bit behind on updates). I will add this once it’s released.

Best,

Gabriel
