Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the image of a facebook post #486

Open
Rabelaiss opened this issue Dec 3, 2020 · 0 comments
Open

Replace the image of a facebook post #486

Rabelaiss opened this issue Dec 3, 2020 · 0 comments

Comments

@Rabelaiss
Copy link

Rabelaiss commented Dec 3, 2020

Version of the SDK being used

By running

import facebook
print(facebook.__version__)

the result is 3.1.0

Expected Behavior

The image of an existing facebook post gets replaced by the one indicated in the code.

Actual Behavior

Nothing happens and no errors in the console.

Steps to Reproduce

There is a post on my facebook page which has some text and an image, and I would like to replace the image with another one saved on my computer. Using the graph API I'm able to easily update/edit the text of the post in this way

import facebook
page_token = '...'
fb = facebook.GraphAPI(access_token = page_token, version="2.12")
page_id = '...'
post_id = '...'
fb.put_object(parent_object = page_id + '_' + post_id,
              connection_name = '',
              message = 'new text')

I tried to update/edit the image of the post with the commands

fb.put_object(parent_object = page_id + '_' + post_id,
              connection_name = '',
              message = 'new text',
              source = open('out.png', 'rb'))

and

fb.put_object(parent_object = page_id + '_' + post_id,
              connection_name = '',
              message = 'new text',
              object_attachment = open('out.png', 'rb'))

but none of them works, even though there are no errors during the execution of the code.
What is wrong?
In the documentation there are only two parameters for put_object even though they are more for sure, so I don't understand if I'm doing something wrong or if there is something wrong with the function itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant