diff --git a/recommendation_engine.py b/recommendation_engine.py index 7482277..30cbbb7 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -49,7 +49,7 @@ class Engine: playlists = playlists[channels['keywords']:] # Count tags for the user count = {} - for event in user['events']: + for event in user.get('events', []): if 'product' in event['data']: count[event['data']['product']] = count.get( event['data']['product'], 0