Merge branch '8784-dir-listings'
[arvados.git] / doc / _includes / _events_py.liquid
1 #!/usr/bin/env python
2 {% comment %}
3 Copyright (C) The Arvados Authors. All rights reserved.
4
5 SPDX-License-Identifier: CC-BY-SA-3.0
6 {% endcomment %}
7
8 import arvados
9 import arvados.events
10
11 # 'ev' is a dict containing the log table record describing the change.
12 def on_message(ev):
13     if ev.get("event_type") == "create" and ev.get("object_kind") == "arvados#collection":
14         print "A new collection was created: %s" % ev["object_uuid"]
15
16 api = arvados.api("v1")
17 ws = arvados.events.subscribe(api, [], on_message)
18 ws.run_forever()