通过Open Graph API发布时,Facebook wallpost图像不会呈现

当通过Open Graph API制作墙贴时,需要让Facebook在墙上贴图中呈现图像。

当我将这个链接复制并粘贴到facebook.com的Facebook用户界面中,并以这种方式发布时,墙贴的结果如下所示:

FB墙贴中的成功渲染图像

但是,当我尝试使用Facebook Python库以编程方式访问我的墙时,使用下面的代码,图像不呈现:

graph = GraphAPI(valid_access_token)
graph.put_wall_post(message='https://s3.amazonaws.com/dotellapptest/review_photos/enlarged/811..OJUzXI76Rw6J2Zj_vZyWNw.png')

产生这个:

带有图像的Facebook墙贴不成功

我如何使用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)

https://github.com/pythonforfacebook/facebook-sdk/blob/master/facebook.py#L142

http://developers.facebook.com/docs/reference/api/user/#links

链接地址: http://www.djcxy.com/p/68409.html

上一篇: Facebook wallpost image won't render when posting through the Open Graph API

下一篇: default document not displaying complete url