Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Marmalade is a fruit preserve made from the juice and peel of citrus fruits, boiled with sugar and water.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 marmalade
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 INSTALL
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.md
Octocat-spinner-32 marmalade.jpg
Octocat-spinner-32 setup.cfg
Octocat-spinner-32 setup.py
Octocat-spinner-32 test.py
README.md

Marmalade - A Python Client for This Is My Jam

  • Tastes Great
  • Good on Toast
  • Easy to use!

INSTALL

$ easy_install -U marmalade

GETTING STARTED

import marmalade

me = marmalade.TIMJUser('tylerbw')
def print_friends(user):
    print "Followers:"
    for i, follower in enumerate(user.get_followers(sort='affinity')):
        print '\t',i,':',follower.get_full_name()

print_friends(me)

def find_slacker_friends(user):
    return [friend for friend in user.get_followers() if not friend.has_current_jam()]

print find_slacker_friends(me)

a_jam = marmalade.Jam.from_user('flaneur')
print a_jam.get_num_plays()

def find_most_popular_follower(user):
    return sorted((friend.get_num_followers(),friend) for friend in user.get_followers())[-1][1]

print find_most_popular_follower(me)

import random
def random_walk_generator(user, steps_away):
    yield user
    followers = user.get_followers()
    for _ in xrange(steps_away):
        new_user = random.choice(followers)
        yield new_user
        user = new_user
        followers = user.get_followers()

print " ==> ".join(u.id for u in random_walk_generator(me, 4))

ADVANCED

Look at the source or test.py for more examples.

YUM

alt text

Something went wrong with that request. Please try again.