Cisco Glass应用程序的包装器/SDK
ciscoglass的Python项目详细描述
CiscoGlass Python SDK开发包
这是一个python库,可以帮助简化为Cisco Glass构建python应用程序的过程。在
这提供了一个接口,可以抽象出所需的大部分重复代码。在
下面是一个示例:
fromciscoglassimportGlassAppimportrequestsimporttimeclassSampleRequest(GlassApp):defrun(self):endpoint=self.get_devices("TEST")[0]resp=requests.get(f"https://{endpoint.host}/json",auth=(endpoint.username,endpoint.password))withself.file("log.txt",'w')asf:f.writelines([f"Log Time: {time.strftime('%Y%m%d-%H%M%S')}\n",resp.text+'\n'])print("Ran successfully, please check the log for more details!")if__name__=="__main__":SampleRequest().run()
它提供了一个健壮的文件访问方法,该方法具有“写入时复制”等功能,以防您想修改输入文件,而无需手动将文件复制到输出位置。在
此外,不需要记住输入/输出文件的位置,也不需要调用设备列表的API等
此外,它还有一个CLI接口,可以让您从应用程序的默认模板开始,包括Dockerfile和为您创建的示例JSON规范。 您可以这样运行命令:
^{pr2}$- 项目
标签: