Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
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