本文以PyCharm为例介绍在Windows操作系统中使用Python接入游戏盾SDK的操作方法。
前提条件
从游戏盾控制台获取Windows版本的SDK包和AccessKey(即Appkey)。更多信息,请参见获取SDK和AccessKey。
从游戏盾控制台获取以下信息。
操作步骤
运行Python编辑器。示例中运行PyCharm。
新建一个Python 64位环境工程。
在代码中添加以下内容,载入YunCeng-WINDOWS.dll。
g_Dll = cdll.LoadLibrary("YunCeng-WINDOWS.dll")
测试是否可以获取IP。
Init_result = g_Dll.YunCeng_InitEx(access_key,token)//初始化 #返回值 ip_len=18 ip = create_string_buffer('/0'*ip_len) port_len=18 port = create_string_buffer('/0'*port_len) ret=g_Dll.YunCeng_GetProxyTcpByDomain("玩家ID","GroupName","防护目标标识","防护目标端口", ip, ip_len, port,port_len); if ret == 0 ://获取成功