展开菜单
首页 精品内容 本月促销 装机必备 Windows PDF教程 macOS软件 IOS软件 Android AI 专题
全部分类

当前位置:

首页 > 编程开发 > Python装饰器实现网络请求重试及超时控制

Python装饰器实现网络请求重试及超时控制

一、前言在写业务代码时候,有许多场景需要重试某块业务逻辑,例如网络请求、购物下单等,希望发生异常的时候多重试几次。二、简单分析一个重试装饰器,最重要的就是发生意外异常处理失败自动重试,有如下几点需要注意失败不能一直重试,因为可能会出现死循环浪费资源,因此需要有最大重试次数或者最大超时时间不能重试太频繁,因为太频繁容易导致重试次数很快用完,却没有成功响应,需要有重试时间间隔来限制,有时可以加大成功概率,例如网络请求时有一段时间是堵塞的,或者对方服务负载太高导致一段时间无法响应等。简单分析完,我们的重试装饰器

    一、前言

    在写业务代码时候,有许多场景需要重试某块业务逻辑,例如网络请求、购物下单等,希望发生异常的时候多重试几次。

    二、简单分析

    一个重试装饰器,最重要的就是发生意外异常处理失败自动重试,有如下几点需要注意

    • 失败不能一直重试,因为可能会出现死循环浪费资源,因此需要有 最大重试次数 或者 最大超时时间

    • 不能重试太频繁,因为太频繁容易导致重试次数很快用完,却没有成功响应,需要有 重试时间间隔 来限制,有时可以加大成功概率,例如网络请求时有一段时间是堵塞的,或者对方服务负载太高导致一段时间无法响应等。

    简单分析完,我们的重试装饰器,就要支持可配置最大重试次数、最大超时时间、重试间隔,所以装饰器就要设计成带参数装饰器。

    三、代码模拟实现

    重试装饰器-初版

    分析完毕后,看看第一版的装饰器

    import time
    from functools import wraps
    def task_retry(max_retry_count: int = 5, time_interval: int = 2):
        """
        任务重试装饰器
        Args:
            max_retry_count: 最大重试次数 默认5次
            time_interval: 每次重试间隔 默认2s
        """
        def _task_retry(task_func):
            @wraps(task_func)
            def wrapper(*args, **kwargs):
                # 函数循环重试
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    try:
                        task_result = task_func(*args, **kwargs)
                        return task_result
                    except Exception as e:
                        print(f"fail {str(e)}")
                        time.sleep(time_interval)
            return wrapper
        return _task_retry

    装饰器内部闭包,就简单通过 for 循环 来执行指定重试次数,成功获取结果就直接 return 返回,发生异常则睡眠配置重试间隔时间后继续循环

    写个例子来模拟测试下看看效果

    没有异常正常执行,在函数中模拟一个异常来进行重试看看

    @task_retry(max_retry_count=3, time_interval=1)
    def user_place_order():
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    ret = user_place_order()
    print("user place order ret", ret)
    >>>out
    fail division by zero
    execute count 2
    fail division by zero
    execute count 3
    fail division by zero
    user place order ret None

    可以看到 user_place_order 函数执行了三遍,都发生了除零异常,最后超过最大执行次数,返回了 None 值,我们可以在主逻辑中来判断返回值是否为 None 来进行超过最大重试次数失败的业务逻辑处理

    ret = user_place_order()
    print("user place order ret", ret)
    
    if not ret:
        print("user place order failed")
        ...

    重试装饰器-改进版

    现在只能配置 最大重试次数 没有最大超时时间,有时候我们想不但有重试,还得在规定时间内完成,不想浪费太多试错时间。所以增加一个 最大超时时间配置选项默认为None,有值时超过最大超时时间退出重试。

    def task_retry(max_retry_count: int = 5, time_interval: int = 2, max_timeout: int = None):
        """
        任务重试装饰器
        Args:
            max_retry_count: 最大重试次数 默认 5 次
            time_interval: 每次重试间隔 默认 2s
            max_timeout: 最大超时时间,单位s 默认为 None,
        """
    
        def _task_retry(task_func):
    
            @wraps(task_func)
            def wrapper(*args, **kwargs):
                # 函数循环重试
                start_time = time.time()
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    use_time = time.time() - start_time
                    if max_timeout and use_time > max_timeout:
                        # 超出最大超时时间
                        print(f"execute timeout, use time {use_time}s, max timeout {max_timeout}")
                        return
    
                    try:
                        return task_func(*args, **kwargs)
                    except Exception as e:
                        print(f"fail {str(e)}")
                        time.sleep(time_interval)
    
            return wrapper
    
        return _task_retry

    看看效果

    # 超时
    @task_retry(max_retry_count=3, time_interval=1, max_timeout=2)
    def user_place_order():
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    >>>out
    execute count 1
    fail division by zero
    execute count 2
    fail division by zero
    execute count 3
    execute timeout, use time 2.010528802871704s, max timeout 2
    user place order ret None
    # 超过最大重试次数
    @task_retry(max_retry_count=3, time_interval=1)
    def user_place_order():
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    >>>out
    execute count 1
    fail division by zero
    execute count 2
    fail division by zero
    execute count 3
    fail division by zero
    user place order ret None
    # 正常
    @task_retry(max_retry_count=3, time_interval=1, max_timeout=2)
    def user_place_order():
        # a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    >>>out
    execute count 1
    user place order success
    user place order ret {'code': 0, 'msg': 'ok'}

    重试装饰器-加强版

    到这重试装饰器基本功能就实现了,但还可以加强,Python现在支持 async 异步方式写法,因此要是可以兼容异步写法那就更好了。先看看装饰异步函数会是什么样的效果

    import time
    import asyncio
    import functools
    def task_retry(max_retry_count: int = 5, time_interval: int = 2, max_timeout: int = None):
        """
        任务重试装饰器
        Args:
            max_retry_count: 最大重试次数 默认 5 次
            time_interval: 每次重试间隔 默认 2s
            max_timeout: 最大超时时间,单位s 默认为 None,
        """
        def _task_retry(task_func):
            @wraps(task_func)
            def wrapper(*args, **kwargs):
                # 函数循环重试
                start_time = time.time()
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    use_time = time.time() - start_time
                    if max_timeout and use_time > max_timeout:
                        # 超出最大超时时间
                        print(f"execute timeout, use time {use_time}s, max timeout {max_timeout}")
                        return
                    try:
                        return task_func(*args, **kwargs)
                    except Exception as e:
                        print(f"fail {str(e)}")
                        time.sleep(time_interval)
            return wrapper
        return _task_retry
    @task_retry(max_retry_count=3, time_interval=1, max_timeout=2)
    def user_place_order():
        # a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    @task_retry(max_retry_count=3, time_interval=2, max_timeout=5)
    async def user_place_order_async():
        """异步函数重试案例"""
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    async def main():
        # 同步案例
        # ret = user_place_order()
        # print(f"user place order ret {ret}")
        # 异步案例
        ret = await user_place_order_async()
        print(f"user place order ret {ret}")
    if __name__ == '__main__':
        asyncio.run(main())
    # 正常时候
    execute count 1
    user place order success
    user place order ret {'code': 0, 'msg': 'ok'}
    # 异常时候
    >>>out
    execute count 1
    Traceback (most recent call last):
      File "G:/code/python/py-tools/decorator/base.py", line 138, in 
        asyncio.run(main())
      File "G:\softs\DevEnv\python-3.7.9\lib\asyncio\runners.py", line 43, in run
        return loop.run_until_complete(main)
      File "G:\softs\DevEnv\python-3.7.9\lib\asyncio\base_events.py", line 587, in run_until_complete
        return future.result()
      File "G:/code/python/py-tools/decorator/base.py", line 133, in main
        ret = await user_place_order_async()
      File "G:/code/python/py-tools/decorator/base.py", line 121, in user_place_order_async
        a = 1 / 0
    ZeroDivisionError: division by zero
    Process finished with exit code 1

    发现发生异常的时候并没有重试,为什么呢?其实在执行 task_func() 它并没有真正的执行内部逻辑,而是返回一个 coroutine 协程对象,并不会报异常,所以再装饰器中执行一遍就成功就出来了,外面 ret = await user_place_order_async(), 后才真正的等待执行,然后执行函数内的逻辑再报异常就没有捕获到。我们可以打断点验证下

    Python装饰器实现网络请求重试及超时控制

    这样装饰器就不支持异步函数的重试,需要加强它,可以使用 asyncio.iscoroutinefunction() 来进行异步函数的判断, 然后再加一个异步函数的闭包就可以实现异步、同步函数都兼容的重试装饰器。

    def task_retry(max_retry_count: int = 5, time_interval: int = 2, max_timeout: int = None):
        """
        任务重试装饰器
        Args:
            max_retry_count: 最大重试次数 默认 5 次
            time_interval: 每次重试间隔 默认 2s
            max_timeout: 最大超时时间,单位s 默认为 None,
        """
    
        def _task_retry(task_func):
    
            @functools.wraps(task_func)
            def sync_wrapper(*args, **kwargs):
                # 同步循环重试
                start_time = time.time()
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    use_time = time.time() - start_time
                    if max_timeout and use_time > max_timeout:
                        # 超出最大超时时间
                        print(f"execute timeout, use time {use_time}s, max timeout {max_timeout}")
                        return
    
                    try:
                        task_ret = task_func(*args, **kwargs)
                        return task_ret
                    except Exception as e:
                        print(f"fail {str(e)}")
                        time.sleep(time_interval)
    
            @functools.wraps(task_func)
            async def async_wrapper(*args, **kwargs):
                # 异步循环重试
                start_time = time.time()
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    use_time = time.time() - start_time
                    if max_timeout and use_time > max_timeout:
                        # 超出最大超时时间
                        print(f"execute timeout, use time {use_time}s, max timeout {max_timeout}")
                        return
    
                    try:
                        return await task_func(*args, **kwargs)
                    except Exception as e:
                        print(f"fail {str(e)}")
                        await asyncio.sleep(time_interval)
    
            # 异步函数判断
            wrapper_func = async_wrapper if asyncio.iscoroutinefunction(task_func) else sync_wrapper
            return wrapper_func
    
        return _task_retry

    注意时间等待 await asyncio.sleep(time_interval) 会导致函数挂起,程序不会在这里等待,而是去事件循环loop中执行其他的已经就绪的任务,如果其他函数运行时间太久了才切换回来,会导致时间超时,换成 time.sleep()的话其实也没有用,如果函数内部还有异步函数执行还是会切换出去,因此异步的时候感觉超时参数意义不大。

    模拟测试下

    @task_retry(max_retry_count=5, time_interval=2, max_timeout=5)
    async def user_place_order_async():
        """异步函数重试案例"""
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    
    
    async def io_test():
        """模拟io阻塞"""
        print("io test start")
        time.sleep(3)
        print("io test end")
        return "io test end"
    
    
    async def main():
        # 同步案例
        # ret = user_place_order()
        # print(f"user place order ret {ret}")
    
        # 异步案例
        # ret = await user_place_order_async()
        # print(f"user place order ret {ret}")
    
        # 并发异步
        order_ret, io_ret = await asyncio.gather(
            user_place_order_async(),
            io_test(),
        )
        print(f"io ret {io_ret}")
        print(f"user place order ret {order_ret}")
    
    
    if __name__ == '__main__':
        asyncio.run(main())
        
        
     >>>out
    execute count 1
    fail division by zero
    io test start
    io test end
    execute count 2
    fail division by zero
    execute count 3
    execute timeout, use time 5.015768527984619s, max timeout 5
    io ret io test end
    user place order ret None

    可以看出执行一遍后自动切换到了 io_test 中执行由于 io test 中的 time.sleep(3) 会导致整个线程阻塞,一定要等到io_test执行完后才会切换回去,然后再执行两遍就超时了,你可能会说都用异步的库,是的异步的库是可以加速,但我想表达就是这时候统计的耗时是整个程序的而不是单独一个函数的。大家可以在评论区帮我想想有没有其他的方法,要么就不要用这个超时参数。

    可以兼容异步函数、然后超时参数可以不配置,影响不大,O(∩_∩)O~

    重试装饰器-最终版

    最终版就是利用抛异常的方式来结束超过最大重试次数、最大超时,而不是直接返回None,然后再添加一个可配置捕获指定异常的参数,当发生特定异常的时候才重试。

    import time
    import asyncio
    import functools
    from typing import Type
    
    
    class MaxRetryException(Exception):
        """最大重试次数异常"""
        pass
    
    
    class MaxTimeoutException(Exception):
        """最大超时异常"""
        pass
    
    
    def task_retry(
            max_retry_count: int = 5,
            time_interval: int = 2,
            max_timeout: int = None,
            catch_exc: Type[BaseException] = Exception
    ):
        """
        任务重试装饰器
        Args:
            max_retry_count: 最大重试次数 默认 5 次
            time_interval: 每次重试间隔 默认 2s
            max_timeout: 最大超时时间,单位s 默认为 None,
            catch_exc: 指定捕获的异常类用于特定的异常重试 默认捕获 Exception
        """
    
        def _task_retry(task_func):
    
            @functools.wraps(task_func)
            def sync_wrapper(*args, **kwargs):
                # 函数循环重试
                start_time = time.time()
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    use_time = time.time() - start_time
                    if max_timeout and use_time > max_timeout:
                        # 超出最大超时时间
                        raise MaxTimeoutException(f"execute timeout, use time {use_time}s, max timeout {max_timeout}")
    
                    try:
                        task_ret = task_func(*args, **kwargs)
                        return task_ret
                    except catch_exc as e:
                        print(f"fail {str(e)}")
                        time.sleep(time_interval)
                else:
                    # 超过最大重试次数, 抛异常终止
                    raise MaxRetryException(f"超过最大重试次数失败, max_retry_count {max_retry_count}")
    
            @functools.wraps(task_func)
            async def async_wrapper(*args, **kwargs):
                # 异步循环重试
                start_time = time.time()
                for retry_count in range(max_retry_count):
                    print(f"execute count {retry_count + 1}")
                    use_time = time.time() - start_time
                    if max_timeout and use_time > max_timeout:
                        # 超出最大超时时间
                        raise MaxTimeoutException(f"execute timeout, use time {use_time}s, max timeout {max_timeout}")
    
                    try:
                        return await task_func(*args, **kwargs)
                    except catch_exc as e:
                        print(f"fail {str(e)}")
                        await asyncio.sleep(time_interval)
                else:
                    # 超过最大重试次数, 抛异常终止
                    raise MaxRetryException(f"超过最大重试次数失败, max_retry_count {max_retry_count}")
    
            # 异步函数判断
            wrapper_func = async_wrapper if asyncio.iscoroutinefunction(task_func) else sync_wrapper
            return wrapper_func
    
        return _task_retry
    
    
    @task_retry(max_retry_count=3, time_interval=1, catch_exc=ZeroDivisionError,max_timeout=5)
    def user_place_order():
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    
    
    @task_retry(max_retry_count=5, time_interval=2, max_timeout=5)
    async def user_place_order_async():
        """异步函数重试案例"""
        a = 1 / 0
        print("user place order success")
        return {"code": 0, "msg": "ok"}
    
    
    async def io_test():
        """模拟io阻塞"""
        print("io test start")
        time.sleep(3)
        print("io test end")
        return "io test end"
    
    
    async def main():
        # 同步案例
        try:
            ret = user_place_order()
            print(f"user place order ret {ret}")
        except MaxRetryException as e:
            # 超过最大重试次数处理
            print("MaxRetryException", e)
        except MaxTimeoutException as e:
            # 超过最大超时处理
            print("MaxTimeoutException", e)
    
        # 异步案例
        # ret = await user_place_order_async()
        # print(f"user place order ret {ret}")
    
        # 并发异步
        # order_ret, io_ret = await asyncio.gather(
        #     user_place_order_async(),
        #     io_test(),
        # )
        # print(f"io ret {io_ret}")
        # print(f"user place order ret {order_ret}")
    
    
    if __name__ == '__main__':
        asyncio.run(main())

    测试捕获指定异常

    # 指定捕获除零错误,正常捕获重试
    @task_retry(max_retry_count=3, time_interval=1, catch_exc=ZeroDivisionError)
    def user_place_order():
        a = 1 / 0
        # a = []
        # b = a[0]
        print("user place order success")
        return {"code": 0, "msg": "ok"}
     
    
    # out
    execute count 1
    fail division by zero
    execute count 2
    fail division by zero
    execute count 3
    fail division by zero
    MaxRetryException 超过最大重试次数失败, max_retry_count 3
    
    
    # 指定捕获除零错误,报索引越界错误,未正常捕获重试,直接退出
    @task_retry(max_retry_count=3, time_interval=1, catch_exc=ZeroDivisionError)
    def user_place_order():
        # a = 1 / 0
        a = []
        b = a[0]
        print("user place order success")
        return {"code": 0, "msg": "ok"}
     
    
    # out
    Traceback (most recent call last):
      File "G:/code/python/py-tools/decorator/base.py", line 184, in <module>
        asyncio.run(main())
      File "G:\softs\DevEnv\python-3.7.9\lib\asyncio\runners.py", line 43, in run
        return loop.run_until_complete(main)
      File "G:\softs\DevEnv\python-3.7.9\lib\asyncio\base_events.py", line 587, in run_until_complete
        return future.result()
      File "G:/code/python/py-tools/decorator/base.py", line 161, in main
        ret = user_place_order()
      File "G:/code/python/py-tools/decorator/base.py", line 97, in sync_wrapper
        task_ret = task_func(*args, **kwargs)
      File "G:/code/python/py-tools/decorator/base.py", line 137, in user_place_order
        b = a[0]
    IndexError: list index out of range
    
    Process finished with exit code 1

    修改记录

    • 把重试里的超时计算单独抽离出来,这样功能不会太藕合,分两个装饰实现

    def set_timeout(timeout: int, use_signal=False):
        """
        超时处理装饰器
        Args:
            timeout: 超时时间,单位秒
            use_signal: 使用信号量机制只能在 unix内核上使用,默认False
        Raises:
            TimeoutException
        """
        def _timeout(func: Callable):
            def _handle_timeout(signum, frame):
                raise MaxTimeoutException(f"Function timed out after {timeout} seconds")
            @functools.wraps(func)
            def sync_wrapper(*args, **kwargs):
                # 同步函数处理超时
                if use_signal:
                    # 使用信号量计算超时
                    signal.signal(signal.SIGALRM, _handle_timeout)
                    signal.alarm(timeout)
                    try:
                        return func(*args, **kwargs)
                    finally:
                        signal.alarm(0)
                else:
                    # 使用线程
                    with ThreadPoolExecutor() as executor:
                        future = executor.submit(func, *args, **kwargs)
                        try:
                            return future.result(timeout)
                        except TimeoutError:
                            raise MaxTimeoutException(f"Function timed out after {timeout} seconds")
            @functools.wraps(func)
            async def async_wrapper(*args, **kwargs):
                # 异步函数处理超时
                try:
                    ret = await asyncio.wait_for(func(*args, **kwargs), timeout)
                    return ret
                except asyncio.TimeoutError:
                    raise MaxTimeoutException(f"Function timed out after {timeout} seconds")
            return async_wrapper if asyncio.iscoroutinefunction(func) else sync_wrapper
        return _timeout
    def retry(
            max_count: int = 5,
            interval: int = 2,
            catch_exc: Type[BaseException] = Exception
    ):
        """
        重试装饰器
        Args:
            max_count: 最大重试次数 默认 5 次
            interval: 每次异常重试间隔 默认 2s
            catch_exc: 指定捕获的异常类用于特定的异常重试 默认捕获 Exception
        Raises:
            MaxRetryException
        """
        def _retry(task_func):
            @functools.wraps(task_func)
            def sync_wrapper(*args, **kwargs):
                # 函数循环重试
                for retry_count in range(max_count):
                    logger.info(f"{task_func} execute count {retry_count + 1}")
                    try:
                        return task_func(*args, **kwargs)
                    except catch_exc:
                        logger.error(f"fail {traceback.print_exc()}")
                        if retry_count < max_count - 1:
                            # 最后一次异常不等待
                            time.sleep(interval)
                # 超过最大重试次数, 抛异常终止
                raise MaxRetryException(f"超过最大重试次数失败, max_retry_count {max_count}")
            @functools.wraps(task_func)
            async def async_wrapper(*args, **kwargs):
                # 异步循环重试
                for retry_count in range(max_count):
                    logger.info(f"{task_func} execute count {retry_count + 1}")
                    try:
                        return await task_func(*args, **kwargs)
                    except catch_exc as e:
                        logger.error(f"fail {str(e)}")
                        if retry_count < max_count - 1:
                            await asyncio.sleep(interval)
                # 超过最大重试次数, 抛异常终止
                raise MaxRetryException(f"超过最大重试次数失败, max_retry_count {max_count}")
            # 异步函数判断
            wrapper_func = async_wrapper if asyncio.iscoroutinefunction(task_func) else sync_wrapper
            return wrapper_func
        return _retry
    本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系bd@zhengruan.com
    作者最新文章
    编程开发 Python
    相关文章 更多
    精品专题 更多
    装机必备

    正软商城装机必备专区,精选办公、浏览器、安全防护、影音播放、压缩解压、设计创作和系统工具等电脑常用正版软件,帮助用户快速完成新电脑软件配置。

    Windows

    正软商城Windows软件专区,汇集适用于Windows电脑的办公、设计、安全防护、影音播放、开发工具和系统优化软件,提供软件介绍、系统要求、正版授权及购买下载服务。

    PDF教程

    正软商城PDF教程频道提供PDF编辑、转换、合并、拆分、压缩及格式处理方法,同时介绍常用PDF软件和工具的使用技巧。

    macOS软件

    正软商城macOS软件专区,精选适用于Mac电脑的办公、设计、影音、效率、开发和系统工具,提供软件功能介绍、macOS兼容版本、正版授权及购买下载服务。

    IOS软件

    正软商城iOS软件专区,精选适用于iPhone和iPad的办公、学习、影音、设计、效率及AI应用,提供功能介绍、适用设备、系统要求和正版获取方式等信息。

    AI

    正软商城AI软件专区,汇集AI写作、AI绘画、AI视频、AI办公、AI编程、AI翻译、智能客服和数据分析等人工智能工具,提供功能介绍、适用平台、收费方式及正版购买信息。

    Mac软件 更多
    WPS Office macOS版
    WPS Office macOS版

    WPS Office是一款面向macOS用户的综合办公套件,将文字处理、电子表格、演示文稿、PDF工具、模板与云协作整合在同一应用中。它兼容常见Microsoft Office格式,支持Intel及Apple芯片Mac,基础功能可免费使用,

    Shapr3D macOS版
    Shapr3D macOS版

    Shapr3D是一款面向工业设计、机械工程、建筑概念和三维打印工作流的CAD软件。Mac版采用Parasolid建模内核,支持草图约束、实体建模、工程图、可视化渲染及常见CAD格式交换,并可通过账户在多台设备之间同步项目。

    REAPER macOS版
    REAPER macOS版

    REAPER是Cockos开发的数字音频工作站,提供多轨音频与MIDI录制、剪辑、处理、混音和母带制作工具。Mac版兼容Intel与Apple芯片,支持AU、VST、VST3、CLAP等插件格式,并提供高度可定制的工作流程。

    Ableton Live macOS版
    Ableton Live macOS版

    Ableton Live 是面向音乐制作人与现场表演者的数字音频工作站,提供编曲视图、独具特色的现场视图、音频录制、MIDI创作、实时变速、乐器及效果器。Mac版原生支持Apple芯片,并可连接音频接口、MIDI控制器和第三方插件。

    Adobe After Effects macOS版
    Adobe After Effects macOS版

    Adobe After Effects 是面向动态图形、影视特效与视频合成的专业创作软件。它提供关键帧动画、遮罩抠像、运动跟踪、三维空间、文字动画和表达式等工具,并可与 Premiere Pro、Photoshop、Illustrator

    Adobe Audition macOS版
    Adobe Audition macOS版

    Adobe Audition 是面向播客、影视后期、音乐制作及内容创作者的专业音频工作站,提供波形精修、多轨录制与混音、频谱编辑、降噪修复、响度匹配和效果处理工具,并可与 Adobe Premiere 协同完成视频声音制作。

    Adobe Bridge macOS版
    Adobe Bridge macOS版

    Adobe Bridge 是面向摄影师、设计师及内容团队的免费数字资产管理工具,可集中预览照片、视频和 Adobe 项目文件,并利用评级、标签、关键词、元数据、筛选与收藏集完成分类检索。它还支持批量重命名、格式导出、相机导入及 Camera

    Adobe Illustrator macOS版
    Adobe Illustrator macOS版

    Adobe Illustrator 是 Adobe 推出的专业矢量图形设计软件,适合在 Mac 上制作标志、图标、插画、包装、信息图及印刷版面。它以路径和锚点构建可无损缩放的图形,并提供钢笔、形状、文字、图像描摹、渐变、画板及生成式功能。

    Adobe InDesign macOS版
    Adobe InDesign macOS版

    Adobe InDesign 是面向印刷品与数字出版物的专业版面设计软件,可在 Mac 上制作书籍、杂志、宣传册、海报、报告及交互式文档。它提供精细的文字样式、网格、母版、长文档管理和印前输出能力。

    Adobe Lightroom Classic macOS版
    Adobe Lightroom Classic macOS版

    Adobe Lightroom Classic 是面向桌面摄影工作流的照片管理与后期处理软件,可将原始照片保存在本地硬盘,通过目录、关键词、评分和收藏夹高效整理图库,并提供 RAW 冲印、蒙版、镜头校正、批量同步及多格式导出等功能。

    Adobe Media Encoder macOS版
    Adobe Media Encoder macOS版

    Adobe Media Encoder 是 Adobe 推出的专业音视频编码与转码工具,可通过队列、预设和监视文件夹批量完成格式转换、代理文件创建及多平台成片输出,并与 Premiere Pro、After Effects 等软件紧密协作。

    Adobe Photoshop macOS版
    Adobe Photoshop macOS版

    Adobe Photoshop 是面向摄影师、设计师和内容创作者的专业图像处理软件,提供图层、蒙版、选区、修复、调色、文字排版、智能对象及生成式编辑等能力。Mac 版支持 Intel 与 Apple Silicon 处理器。

    WINDOWS 更多
    Adobe Photoshop Windows版
    Adobe Photoshop Windows版

    Adobe Photoshop 是面向摄影师、设计师和内容创作者的专业图像处理工具,可在 Windows 上完成照片修饰、选区抠图、图层合成、文字排版、绘画及生成式编辑。软件采用订阅授权,由 Creative Cloud 管理安装、更新与许

    Adobe InDesign Windows版
    Adobe InDesign Windows版

    Adobe InDesign 是面向印刷与数字出版的专业页面排版工具,可制作书籍、杂志、宣传册、海报、交互式 PDF 和电子书。它提供精细的文字样式、多页面管理、印前检查及多格式输出能力,并能与 Photoshop、Illustrator

    Adobe Illustrator Windows版
    Adobe Illustrator Windows版

    Adobe Illustrator 是用于绘制矢量图形、插画、图标、徽标和版式的专业设计工具。它以路径和锚点为核心,作品放大后仍能保持清晰,并提供画板、文字、渐变、图像描摹及精确变换等功能,适合品牌视觉、印刷物料、数字界面和商业插画创作。

    Adobe Bridge Windows版
    Adobe Bridge Windows版

    Adobe Bridge 是 Adobe 推出的创意资产管理工具,可集中预览、分类和查找照片、视频、PDF及多种设计文件,并支持元数据、关键词、评级、批量重命名和格式导出。它可与 Photoshop、Illustrator 等应用衔接,

    Affinity Photo Windows版
    Affinity Photo Windows版

    Affinity Photo 是一款面向摄影师、修图师和视觉设计人员的桌面图像编辑工具,提供 RAW 显影、多图层合成、蒙版、实时滤镜、批处理和色彩管理等功能。原独立产品已停止销售,其照片编辑能力已延续至免费的新 Affinity 应用;

    Adobe Lightroom Classic Windows版
    Adobe Lightroom Classic Windows版

    Adobe Lightroom Classic 是面向 Windows 桌面摄影工作流的照片管理与无损编辑工具,可通过目录集中整理大型图库,并完成 RAW 显影、局部蒙版、批量调整、打印和多格式导出。它强调本地文件管理与精细控制,

    Figma Windows版
    Figma Windows版

    Figma 是面向产品设计与开发团队的云端协作平台,可在 Windows 桌面客户端中完成界面绘制、组件管理、交互原型、评论评审和开发交付。文件保存在云端,多名成员能够同步编辑并共享设计系统;官方同时提供免费 Starter 方案及按席位计

    Affinity Designer Windows版
    Affinity Designer Windows版

    Affinity Designer 是面向矢量图形、数字插画和界面设计的专业创作工具,可在矢量、像素与导出工作区之间快速切换。它提供曲线编辑、形状构建、画板、排版、图层和专业色彩管理,并支持常见设计文件的导入及多种印刷、网页格式输出。

    Capture One Pro Windows版
    Capture One Pro Windows版

    Capture One Pro 是面向摄影师和影像团队的专业桌面照片处理工具,提供相机定制色彩配置、RAW转换、图层与蒙版、联机拍摄、目录及会话管理等功能。它适合棚拍、人像、商业产品、婚礼和风光摄影,

    Adobe Acrobat Pro Windows版
    Adobe Acrobat Pro Windows版

    Adobe Acrobat Pro 是面向专业 PDF 工作的综合解决方案,可在 Windows 中创建、编辑、转换、比较、整理和保护文档,并支持表单、电子签名、扫描件文字识别及敏感信息永久遮盖。订阅还包含网页、移动服务和云端协作能力,

    Adobe After Effects Windows版
    Adobe After Effects Windows版

    Adobe After Effects 是面向动态图形、动画与影视视觉特效制作的专业工具,可完成关键帧动画、图层合成、遮罩跟踪、抠像、文字动画和二维三维元素整合。Windows 版通过 Adobe Creative Cloud 安装及更新,

    DaVinci Resolve Windows版
    DaVinci Resolve Windows版

    DaVinci Resolve是Blackmagic Design推出的一体化影视后期工具,将素材管理、非线性剪辑、专业调色、Fusion视觉特效、Fairlight音频处理和成片交付整合在统一工程中。免费版已覆盖多数个人创作需求,