Skip to content

Instantly share code, notes, and snippets.

@cagerton
Created April 29, 2010 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cagerton/384128 to your computer and use it in GitHub Desktop.
Save cagerton/384128 to your computer and use it in GitHub Desktop.
def publish_to_wall(user,unfriend):
"""Prints out a pretty unfriends notice"""
logging.info('Posting message to %s' % user.id)
args = {'access_token':user.access_token,
'message':'is no longer friends with %s.' % (unfriend['name']),
'picture':'http://graph.facebook.com/%s/picture' % unfriend['id'],
'link':'http://drama-lama.appspot.com',
'description': 'DramaLama - the unfriending monitor.',
}
post_args = urllib.urlencode(args)
urllib.urlopen("http://graph.facebook.com/%s/feed" % user.id, post_args)
args={'object':'user',
'fields':'name,friends',
'callback_url':'http://drama-lama.appspot.com/realtime',
'verify_token':'MY_VERIFY_TOKEN',
'access_token':'MY_OAUTH_ACCESS_TOKEN',
}
url = "https://graph.facebook.com/FACEBOOK-APP-ID/subscriptions"
f=urllib.urlopen(url, urllib.urlencode(args))
f.read()
>>> urllib.urlopen('http://graph.facebook.com/chris.agerton').read()
'{"id":"7952138","name":"Chris Agerton","first_name":"Chris","last_name":"Agerton","link":"http:\\/\\/www.facebook.com\\/chris.agerton"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment