My favorites | Sign in
Project Logo
                
Code license: MIT License
Labels: python, myspace, django
Feeds:
People details
Project owners:
  ervandew

This is a simple client used to access the MySpace Apps REST APIs.

This project includes a modified version of the python oauth code (originally found at http://oauth.googlecode.com/svn/code/python/oauth/). The included version has been modified to run on python 2.4 and fixes a couple issues when working with the myspace urls.

Note: This library depends on the simplejson library (http://pypi.python.org/pypi/simplejson). Developed against version 1.7.3.

Usage:

from myspace.app import Consumer, MySpaceError

security_key = '...'
consumer = Consumer('http://example.com', security_key)
try:
  user = consumer.user(user_id)
except MySpaceError, mse:
  # handle error
  print mse
  print mse.response

App data: Storage and retrieval of data from the MySpace persistent data store.

## Obtaining a handle on the data store

# retrieving the global app data store reference
globaldata = consumer.appdata()

# retrieving user app data store reference
appdata = consumer.appdata(user_id)

## Once you have a handle on the data store you can access
## and update values like any other dictionary

# accessing values
appdata['mykey']

# updating values
appdata['mykey'] = myvalue

## Persisting changes: any updates you make
## to the data need to be explicitly saved.

appdata.save()

## Accessing app data for a user's friends

friend_appdata = consumer.appdata(user_id)
friend_appdata[friend_id]['mykey']
friend_appdata[friend_id]['mykey'] = myvalue
friend_appdata[friend_id].save()

Django: This project also includes some code to ease usage in django.









Hosted by Google Code