I am using facebook API (version 3.1.) to publish automatically on my Facebook feed using a python script (shown below), which was working fine until recently. I found that facebook deprecated the put_photo function from the new api version (8.0), but can't find how to call the new function or new method to publish photos automatically from the python script. So, Is there a new way to do this? What am I missing?
Thanks a lot for the help!
import facebook
import sys,os
import json
import numpy as np
def facebook_post_sentido(figure_name):
def get_cfg():
cfg = {
"page_id" : "my_id"
"access_token" : "my_token"
}
return cfg
def gen_api(cfg):
API = facebook.GraphAPI(cfg['access_token'])
print("generating api connection")
return API
cfg = get_cfg()
API = gen_api(cfg)
photo_id = API.put_photo(image=open(figure_name, 'rb'), )
# API.put_object(parent_object=cfg["page_id"], connection_name="feed",
# message="SISMO SENTIDO RELOCALIZADO",
# attached_media=json.dumps([{'media_fbid': str(photo_id.get('id', ''))}]))
facebook_post_sentido(figure_name="myfigure")
When I run the code I get the following error:
facebook.GraphAPIError: (#200) This endpoint is deprecated since the required permission publish_actions is deprecated