python - pysnmp - Using variables to set the v3 auth & priv tpyes
问题描述
I have variables set with the required auth authProto
and priv privProto
types that I want to substitute for the usmHMACSHAAuthProtocol
and usmAesCfb128Protocol
entries below:
config.addV3User(
snmpEngine, user,
config.usmHMACSHAAuthProtocol, authKey,
config.usmAesCfb128Protocol, privKey
)
What is the cleanest way to make use of these variables?
解决方案
Based on your comment, it seems that your problem is a simple typo. If you do authProto = "config.usmHMACSHAAuthProtocol"
, it is setting authProto to the text config.usmHMACSHAAuthProtocol
. You want to set it to the value. To do this, just remove the quotes:
authProto = config.usmHMACSHAAuthProtocol
.
Then, you can just use it directly when you addV3User
.
推荐阅读
- reactjs - React16 两个组件通信
- getgauge - 我在哪里可以看到 uisng Gauge.writemessage() 写的日志?
- javascript - 在淘汰赛js中首次加载页面后,下拉/复选框选项在第一次点击时没有绑定
- java - Java中的静态和动态类型
- python - 无法从 gui 中的堆栈溢出中恢复
- python - 如果同一行的另一列中有空值,则将列值与前一行连接
- python - 如何将函数导入烧瓶中的主文件?
- node.js - 在 Node 中检查付款状态的有效方法?
- gradle-plugin - 用于 Maven 发布等功能的 Gradle 发布插件
- javascript - 如何使 Bootstrap 4 列跟随页面的滚动?