本文整理匯總了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"])