Best practices for subscribing to data events with Python

I was wondering what is the recommended way to subscribe to data events (e.g. “new file created”) with Python?

The JavaScript version of this scenario works fine for me; however, doing the same with Python seems much harder: stomp.py does not seem to support websockets, and all other projects I have found on GitHub are rather poorly documented / maintained. Maybe this would be a use case for an AMQP interface (as mentioned in the data events docs)? Has anyone tried if this works well with Python?

1 Like

Just want to share that the AMQP interface is part of the next feature release and already available on test-instances.

(Can’t give you an advice for python)

The AMQP interface would be quite interesting for us. How can we get a project on the test-instance? And is there also documentation available? Thanks a lot!

1 Like

It’s pretty much the same. See Documentation | PANTARIS
can be tested on https://platform.pantaris-latest.de

Thanks for the documentation. I got it running with Pika (Client lib for Python). If you are interested I could offer the code snipped as an example for your documentation.

Short hint regarding the documentation: It would be quite helpful to have a note there that the dataEventToken has to be set as username and an empty string has to be set as password. I know this is somehow written down in the node js example, but I think it is not that obvious. Thanks!

Happy to add the example, if you share and confirm that you transfer all the rights of the snippet to us.

It’s also written in the section " Subscribe to events":

You connect to the host /protected/ and use a Data-Event-Token to login. Depending on the stomp-library you are using, the host is usually set in the configuration as host or vhost , while the login is something like login or username or similar.