本文整理匯總了Python中twisted.version方法的典型用法代碼示例。如果您正苦於以下問題:Python twisted.version方法的具體用法?Python twisted.version怎麽用?Python twisted.version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twisted
的用法示例。
在下文中一共展示了twisted.version方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ensure_outgoing_proxy_dependencies
# 需要導入模塊: import twisted [as 別名]
# 或者: from twisted import version [as 別名]
def ensure_outgoing_proxy_dependencies():
"""Make sure that we have the necessary dependencies to connect to
outgoing HTTP/SOCKS proxies.
Raises OutgoingProxyDepsFailure in case of error.
"""
# We can't connect to outgoing proxies without txsocksx.
try:
import txsocksx
except ImportError:
raise OutgoingProxyDepsFailure("We don't have txsocksx. Can't do proxy. Please install txsocksx.")
# We also need a recent version of twisted ( >= twisted-13.2.0)
import twisted
from twisted.python import versions
if twisted.version < versions.Version('twisted', 13, 2, 0):
raise OutgoingProxyDepsFailure("Outdated version of twisted (%s). Please upgrade to >= twisted-13.2.0" % twisted.version.short())
示例2: doWarnings
# 需要導入模塊: import twisted [as 別名]
# 或者: from twisted import version [as 別名]
def doWarnings():
import twisted
from twisted.python import versions
if (twisted.version < versions.Version('twisted', 8, 0, 0)):
LOG.warning("You should get Twisted 8 or later. Previous versions "
"have some bugs that affect Dtella.")
try:
import dtella.bridge
except ImportError:
# Don't warn about GMP for clients, because verifying a signature
# is fast enough without it (~1ms on a Core2)
pass
else:
import Crypto.PublicKey
try:
import Crypto.PublicKey._fastmath
except ImportError:
LOG.warning("Your version of PyCrypto was compiled without "
"GMP (fastmath). Signing messages will be slower.")