How to use the dispatch.vendor.apis.FacebookAPIError function in dispatch

To help you get started, we’ve selected a few dispatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ubyssey / dispatch / dispatch / vendor / apis.py View on Github external
def _get(self, uri, params={}):

        r = requests.get(uri, params=params)

        data = r.json()

        if 'error' in data:
            raise FacebookAPIError(data['error']['message'])

        return data
github ubyssey / dispatch / dispatch / apps / events / facebook.py View on Github external
def get_image(self):
        """Returns the picture url from facebook event"""

        try:
            image_data = self.api.get_photos(self.event_id)

            try:
                image_url = self.api.get_picture(image_data[0]['id'])
            except FacebookAPIError:
                image_url = self.api.get_picture(self.event_id)

        except FacebookAPIError:
            raise FacebookEventError(FACEBOOK_ERROR_MESSAGE)

        return image_url
github ubyssey / dispatch / dispatch / vendor / apis.py View on Github external
def _post(self, uri, params={}):

        r = requests.post(uri, data=params)

        data = r.json()

        if 'error' in data:
            raise FacebookAPIError(data['error']['message'])

        return data