Merge branch 'master' into 4904-arv-web
[arvados.git] / doc / _includes / _events_py.liquid
1 #!/usr/bin/env python
2
3 import arvados
4 import arvados.events
5 import json
6
7 # 'ev' is a dict containing the log table record describing the change.
8 def on_message(ev):
9     if ('event_type' in ev and
10         ev['event_type'] == 'create' and
11         ev["object_kind"] == "arvados#collection"):
12         print "A new collection was created %s" % ev['object_uuid']
13
14 api = arvados.api('v1', cache=False)
15 ws = arvados.events.subscribe(api, [], on_message)
16 ws.run_forever()