0

在图形 api 上创建事件时如何上传图像?例子:

user.facebook.put_object("me", "events", name="test", start_time=start_date, end_time=end_date, picture=image)

我试过了:

 image = 'C:\\Path\\to\\image.jpg' #and
 image = open('C:\\Path\\to\\image.jpg', 'a') #and
 image = open('C:\\Path\\to\\image.jpg', 'a').read() #and

没有工作。

4

1 回答 1

0

来自 github 上的文档:https ://github.com/pythonforfacebook/facebook-sdk/

graph = facebook.GraphAPI(oauth_access_token)
tags = json.dumps([{'x':50, 'y':50, tag_uid:12345}, {'x':10, 'y':60, tag_text:'a turtle'}])
graph.put_photo(open('img.jpg'), 'Look at this cool photo!', album_id_or_None, tags=tags)
于 2012-07-17T01:59:19.717 回答