def get(self, photo_id):
     token = get_token_from_header(request)
     try:
         mode = request.args.get('mode')
         user = get_cognito_user(token)
         email = user['email']
         return presigned_url(photo_id, email, True if mode else False)
     except Exception as e:
         app.logger.error('ERROR:get photo failed:photo_id:{}'.format(photo_id))
         app.logger.error(e)
         return 'http://placehold.it/400x300'
Пример #2
0
 def get(self, photo_id):
     """
     Return image for thumbnail and original photo.
     :param photo_id: target photo id
     :queryparam mode: None(original) or thumbnail
     :return: image url for authenticated user
     """
     try:
         mode = request.args.get('mode')
         user = get_jwt_identity()
         email = user['email']
         return presigned_url(photo_id, email, True if mode else False)
     except Exception as e:
         app.logger.error(
             'ERROR:get photo failed:photo_id:{}'.format(photo_id))
         app.logger.error(e)
         return 'http://placehold.it/400x300'