Python interface to This Is My Jam API.
Project description
# Marmalade - A Python Client for [This Is My Jam](http://thisismyjam.com/)
* 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](https://github.com/tylerwilliams/marmalade/blob/master/test.py) for more examples.
## YUM
![alt text](https://raw.github.com/tylerwilliams/marmalade/master/marmalade.jpg "mmmmm (from: http://www.flickr.com/photos/wendycopley/4451578552/sizes/n/in/photostream/)")
* 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](https://github.com/tylerwilliams/marmalade/blob/master/test.py) for more examples.
## YUM
![alt text](https://raw.github.com/tylerwilliams/marmalade/master/marmalade.jpg "mmmmm (from: http://www.flickr.com/photos/wendycopley/4451578552/sizes/n/in/photostream/)")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
marmalade-1.1.0.tar.gz
(6.1 kB
view details)
File details
Details for the file marmalade-1.1.0.tar.gz
.
File metadata
- Download URL: marmalade-1.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da593d9a3b9f2984a9ed6dc6b153e5f0eee4c803b3148da5576018fa2b718f10 |
|
MD5 | 9e9041015be596b036661faddcb5f7e2 |
|
BLAKE2b-256 | f8484921660e663c5f6974725559e879cda7f642821978f2c42e2ab952a728b0 |