def upload_img(): files = request.files file = files.get('file') url = '' if file is not None: if file.filename.split('.')[1] not in [ 'png', 'jpg', 'jpeg', 'bmp', 'gif' ]: return Response.failed(msg='图片格式错误') url = QiniuService.upload_img(file.read()) return Response.success(url)
def error_handler(exception: Exception): if exception: log.error(traceback.format_exc()) return Response.failed(msg=f'{exception}')