Cla*_*ell 7 facebook image facebook-wall facebook-graph-api
当墙贴通过Open Graph API制作时,需要一种方法让Facebook在墙柱中渲染图像.
当我将这个链接复制并粘贴到facebook.com上的Facebook用户界面并以这种方式发布时,墙贴最终看起来像这样:
但是,当我尝试使用Facebook Python库以编程方式访问我的墙时,使用下面的代码,图像不会呈现:
graph = GraphAPI(valid_access_token)
graph.put_wall_post(message='https://s3.amazonaws.com/dotellapptest/review_photos/enlarged/811..OJUzXI76Rw6J2Zj_vZyWNw.png')
Run Code Online (Sandbox Code Playgroud)
收益率:
如何使用Facebook API在我的留言板中嵌入图像?
使用该link
字段而不是message
通过附件的字段
def put_wall_post(self, message, attachment={}, profile_id="me"):
"""Writes a wall post to the given profile's wall.
We default to writing to the authenticated user's wall if no
profile_id is specified.
attachment adds a structured attachment to the status message
being posted to the Wall. It should be a dictionary of the form:
{"name": "Link name"
"link": "http://www.example.com/",
"caption": "{*actor*} posted a new review",
"description": "This is a longer description of the attachment",
"picture": "http://www.example.com/thumbnail.jpg"}
"""
return self.put_object(profile_id, "feed", message=message,
**attachment)
Run Code Online (Sandbox Code Playgroud)
https://github.com/pythonforfacebook/facebook-sdk/blob/master/facebook.py#L142
http://developers.facebook.com/docs/reference/api/user/#links
归档时间: |
|
查看次数: |
694 次 |
最近记录: |