Example #1
0
def timeline():
    """
    :rtype : json
    """
    podcasts = Podcast().get(limit=10)
    total = []
    for item in podcasts:
        total.append(item.as_dict(['user_id', 'channel_id']))

    return json.dumps({'podcasts': total}), 200
Example #2
0
def podcast():
    uuid = request.form.get('uuid', None)
    channel_uuid = request.form.get('channel_uuid', None)

    if uuid:
        podcasts = Podcast().get(limit=10, uuid=uuid)
    elif channel_uuid:
        channel = Channel.get(uuid=channel_uuid)
        podcasts = Podcast.get(limit=10, channel=channel)

    total = []
    for item in podcasts:
        total.append(item.as_dict(['id', 'user_id', 'channel_id']))

    return json.dumps({'podcasts': total}), 200