Пример #1
0
 def post_as_app(self, profile_id, message, attachment=None):
     attachment=attachment or {}
     graph=GraphAPI()
     graph.fetch_app_access_token()
     try:
         graph.put_wall_post(message, profile_id=str(profile_id), attachment=attachment)
     except GraphAPIError, e:
         logger.error('Problem posting FB: %s' % e)
Пример #2
0
    def post_pages(self, message, attachment=None):
            '''
            https://developers.facebook.com/docs/howtos/login/login-as-page/
            '''

            if not self.fb_objects_ids:
                logger.debug('Not posting any FB pages - not configured')
                return
            attachment=attachment or {}
            for (fbobj_id, access_token) in self.fb_objects_ids:
                graph=GraphAPI(access_token=access_token)
                try:
                    graph.put_wall_post(message, profile_id=str(fbobj_id), attachment=attachment)
                except GraphAPIError, e:
                    logger.error('Problem posting FB: %s' % e)