Skip to content

Instantly share code, notes, and snippets.

View tschellenbach's full-sized avatar

Thierry Schellenbach tschellenbach

View GitHub Profile
@tschellenbach
tschellenbach / getstream_example.py
Created December 15, 2014 13:02
GetStream.io aggregated notification feed example with if statement
# Instantiate a new client
import stream
client = stream.connect('key', 'secret')
# Assume the notification is aggregated on
# {% if verb.infinitive == 'like' %}{{ object }}{% else %}{{ id }}{% endif %}
notification_feed = client.feed('notification', '1')
# Add two likes, one comment and two follows
activities = [
@tschellenbach
tschellenbach / getstream_example_if_statement.py
Created December 15, 2014 13:04
GetStream.io aggregated notification feed example with if statement
# Instantiate a new client
import stream
client = stream.connect('key', 'secret')
# Assume the notification is aggregated on
# {% if verb.infinitive == 'like' %}{{ object }}{% else %}{{ id }}{% endif %}
notification_feed = client.feed('notification', '1')
# Add two likes, one comment and two follows
activities = [
[
{
"actor": "user:dnevozhai",
"verb": "add",
"object": "picture:1",
"foreign_id": "picture:1",
"image": "https://images.unsplash.com/photo-1483664852095-d6cc6870702d?auto=format&fit=crop&w=3450&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D",
"message": "I was driving home from Mammoth Lakes by 88 somewhere near Kirkwood when suddenly after another turn this view has appeared. Not thinking too much I crossed double solids :) and parked on the other side. I left the car and walked in the knee deep snow for like 10 meters further from the road to reach untouched powder and take some nice sunset photos. This was one of them.",
"tags": ["tree", "snow", "winter", "landscape"],
"location": "Kirkwood",