Redis Python 客户端提供了一系列接口与 Redis 服务进行交互,用来管理 Redis 数据库资源。您需要先初始化 Redis Python 客户端,才可以向 Redis 服务发送 HTTP/HTTPS 请求。本文介绍如何初始化 Redis Python 客户端。
使用如下代码初始化客户端。
import volcenginesdkredis import volcenginesdkcore from volcenginesdkcore.rest import ApiException if __name__ == "__main__": configuration = volcenginesdkcore.Configuration() # 设置AKSK验证信息及 Region configuration.ak = "Your AK" configuration.sk = "Your SK" configuration.region = "Your Region" try: # 创建 Redis SDK 客户端,接口调用均需要通过此客户端执行 api_instance = volcenginesdkredis.REDISApi(volcenginesdkcore.ApiClient(configuration)) except ApiException as e: print("Exception: %s\n" % e)