def s3_request(*args, **kwargs):
 error = None
 try:
  r = S3Request(*args, **kwargs)
 except (AttributeError, SyntaxError):
  error = 400
 except KeyError:
  error = 404
 if error:
  if (kwargs.get('catch_errors') is False):
   raise
  message = sys.exc_info()[1]
  if hasattr(message, 'message'):
   message = message.message
  if (current.auth.permission.format == 'html'):
   current.session.error = message
   redirect(URL(f='index'))
  else:
   headers = {'Content-Type': 'application/json'}
   current.log.error(message)
   raise HTTP(error, body=current.xml.json_message(success=False, statuscode=error, message=message), web2py_error=message, **headers)
 return r

def s3_request ( * args , ** kwargs ) : error = None try : r = S3Request ( * args , ** kwargs ) except ( AttributeError , SyntaxError ) : error = 400 except KeyError : error = 404 if error : if ( kwargs . get ( 'catch_errors' ) is False ) : raise message = sys . exc_info ( ) [ 1 ] if hasattr ( message , 'message' ) : message = message . message if ( current . auth . permission . format == 'html' ) : current . session . error = message redirect ( URL ( f = 'index' ) ) else : headers = { 'Content-Type' : 'application/json' } current . log . error ( message ) raise HTTP ( error , body = current . xml . json_message ( success = False , statuscode = error , message = message ) , web2py_error = message , ** headers ) return r
helper function to generate s3request instances .