percy3d/facebook-sdk — pull request #1 by percy3d (2014-12-12 20:18:20+00:00)
Title: changed put_photo to put_media, now supports photo and video upload

Hi,

I actually made this change a while ago(about a year ago). I needed to post video. I changed put_photo to put_media.

def put_media(self, media_path, album_id=None, is_image=True, **kwargs):

The method will properly encode the file contents and post it using the appropriate url, either graph.facebook.com or graph-video.facebook.com.

to post a video:

kwargs = {'title':'testing', 'description':'just a test'}
graph = facebook.GraphAPI(oauth_access_token)
graph.put_media(os.path.join(os.getcwd(), '.mp4'), None, False, **kwargs)

To post a photo:

graph = facebook.GraphAPI(user['access_token'])
graph.put_media(os.path.join(os.getcwd(), '.jpg'), None, True, **kwargs)

Thank you for your time.