【发布时间】:2020-07-28 13:27:09
【问题描述】:
我在使用 tearadatasql 包连接到 taradata 时使用了人类可读的密码,我能够成功连接。但是当我尝试使用相同密码(base64encoded)的 base64 编码字节而不是 readable 时,我收到一个错误“The UserId, Password or Account is invalid”,凭据
base64encoded = base64.b64encode(bytes('可读密码','utf-8')) teradatasql.connect('{"host":"server","user":"username","password":"'+base64encoded+'","logmech":"LDAP"}')
谁能知道,如何在这里传递base64编码的密码?
【问题讨论】:
-
teradatasql documentation 中没有任何内容表示支持 base64 编码。如果目标是避免在脚本中使用明文密码,则可以使用加密机制。
-
谢谢@Fred,你说得对,我也看过文档,但没有找到。有没有其他python包,它支持base64编码的密码,同时连接到teradat
-
我不知道。如果将 base64 值传递给脚本,您可以使用 password= 关键字将 b64decode 值传递给 teradatasql,而不是将其作为 JSON 字符串中的属性值。
标签: python-3.x teradata