Ejemplo n.º 1
0
Archivo: test.py Proyecto: LianGee/zed
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)
Ejemplo n.º 2
0
def error_handler(exception: Exception):
    if exception:
        log.error(traceback.format_exc())
        return Response.failed(msg=f'{exception}')