Created
April 29, 2010 19:47
-
-
Save cagerton/384128 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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