def create_post(self, message): fields = [] params = {'message': message} post = Page(settings.FACEBOOK_PAGE_ID).create_feed( fields=fields, params=params, ) post_id = post.get_id() return post_id
page_id = pages[0].get_id() print 'page_id:', page_id, '\n' # Switch access token to page access token FacebookAdsApi.init(access_token=pages[0].access_token) # Page feed create fields = [] params = { 'message': 'This is a test value', } pagepost = Page(page_id).create_feed( fields=fields, params=params, ) print 'pagepost', pagepost pagepost_id = pagepost.get_id() print 'pagepost_id:', pagepost_id, '\n' # Switch access token back to user access token FacebookAdsApi.init(access_token=access_token) # User adaccounts get fields = [] params = {} adaccounts = User(user_id).get_ad_accounts( fields=fields, params=params, ) print 'adaccounts', adaccounts adaccount_id = adaccounts[0].get_id() print 'adaccount_id:', adaccount_id, '\n'