2013-01-13 26 views
7

當通過Open Graph API製作牆帖時,需要Facebook在牆壁上呈現圖像的方式。當通過Open Graph API發佈時,Facebook wallpost圖像不會呈現

當我複製並粘貼此鏈接到Facebook的UI在facebook.com,並張貼這樣的說法,牆後最終看起來像這樣:

Successful rendered image in FB wall post

但是,當我嘗試訪問編程使用Facebook Python庫,使用下面的代碼我的牆,圖像不渲染:

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

此息率:

unsuccessful Facebook wall post with image

如何使用Facebook API將圖像嵌入牆貼中?

回答

4

經由安裝

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

+0

真棒,謝謝使用link場不message場! –

相關問題