Facebook wallpost image won't render when posting through the Open Graph API

Need a way for Facebook to render images in a wallpost when the wall post is made through the Open Graph API.

When I copy and paste this link into the Facebook UI at facebook.com, and post it that way, the wall post ends up looking like this:

FB墙贴中的成功渲染图像

But, when I try to access my wall programmatically using the Facebook Python library, using the below code, the image does not render:

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

Yields this:

带有图像的Facebook墙贴不成功

How can I use the Facebook API to embed an image in my wall post?


Use the link field not the message field via an attachment

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/68410.html

上一篇: 计算机之间的C目标文件兼容性

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