本文整理汇总了Python中lib.GlobalData.persistent方法的典型用法代码示例。如果您正苦于以下问题:Python GlobalData.persistent方法的具体用法?Python GlobalData.persistent怎么用?Python GlobalData.persistent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.GlobalData
的用法示例。
在下文中一共展示了GlobalData.persistent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from lib import GlobalData [as 别名]
# 或者: from lib.GlobalData import persistent [as 别名]
else:
clientCertFile = None
clientKeyFile = None
# get user credentials
username = str(
configRoot.find("general").find("credentials").attrib["username"])
password = str(
configRoot.find("general").find("credentials").attrib["password"])
# Get connection settings.
temp = (str(
configRoot.find("general").find("connection").attrib[
"persistent"]).upper() == "TRUE")
if temp:
globalData.persistent = 1
else:
globalData.persistent = 0
# parse smtp options if activated
smtpActivated = (str(
configRoot.find("smtp").find("general").attrib[
"activated"]).upper() == "TRUE")
if smtpActivated is True:
smtpServer = str(
configRoot.find("smtp").find("server").attrib["host"])
smtpPort = int(
configRoot.find("smtp").find("server").attrib["port"])
smtpFromAddr = str(
configRoot.find("smtp").find("general").attrib["fromAddr"])
smtpToAddr = str(
示例2: ValueError
# 需要导入模块: from lib import GlobalData [as 别名]
# 或者: from lib.GlobalData import persistent [as 别名]
configRoot.find("general").find("client").attrib["keyFile"])))
if (os.path.exists(clientCertFile) is False
or os.path.exists(clientKeyFile) is False):
raise ValueError("Client certificate or key does not exist.")
else:
clientCertFile = None
clientKeyFile = None
# get user credentials
username = str(
configRoot.find("general").find("credentials").attrib["username"])
password = str(
configRoot.find("general").find("credentials").attrib["password"])
# Set connection settings.
globalData.persistent = 1 # Consider sensor client always persistent
# parse smtp options if activated
smtpActivated = (str(
configRoot.find("smtp").find("general").attrib[
"activated"]).upper() == "TRUE")
if smtpActivated is True:
smtpServer = str(
configRoot.find("smtp").find("server").attrib["host"])
smtpPort = int(
configRoot.find("smtp").find("server").attrib["port"])
smtpFromAddr = str(
configRoot.find("smtp").find("general").attrib["fromAddr"])
smtpToAddr = str(
configRoot.find("smtp").find("general").attrib["toAddr"])