本文整理汇总了Python中wincertstore.CertFile方法的典型用法代码示例。如果您正苦于以下问题:Python wincertstore.CertFile方法的具体用法?Python wincertstore.CertFile怎么用?Python wincertstore.CertFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wincertstore
的用法示例。
在下文中一共展示了wincertstore.CertFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_win_certfile
# 需要导入模块: import wincertstore [as 别名]
# 或者: from wincertstore import CertFile [as 别名]
def get_win_certfile():
try:
import wincertstore
except ImportError:
return None
class CertFile(wincertstore.CertFile):
def __init__(self):
super(CertFile, self).__init__()
atexit.register(self.close)
def close(self):
try:
super(CertFile, self).close()
except OSError:
pass
_wincerts = CertFile()
_wincerts.addstore('CA')
_wincerts.addstore('ROOT')
return _wincerts.name
示例2: _load_wincerts
# 需要导入模块: import wincertstore [as 别名]
# 或者: from wincertstore import CertFile [as 别名]
def _load_wincerts():
"""Set _WINCERTS to an instance of wincertstore.Certfile."""
global _WINCERTS
certfile = CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close)
_WINCERTS = certfile
# XXX: Possible future work.
# - OCSP? Not supported by python at all.
# http://bugs.python.org/issue17123
# - Adding an ssl_context keyword argument to MongoClient? This might
# be useful for sites that have unusual requirements rather than
# trying to expose every SSLContext option through a keyword/uri
# parameter.
示例3: _load_wincerts
# 需要导入模块: import wincertstore [as 别名]
# 或者: from wincertstore import CertFile [as 别名]
def _load_wincerts():
"""Set _WINCERTS to an instance of wincertstore.Certfile."""
global _WINCERTS
certfile = CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close)
_WINCERTS = certfile
# XXX: Possible future work.
# - Support CRL files? Only supported by CPython >= 2.7.9 and >= 3.4
# http://bugs.python.org/issue8813
# - OCSP? Not supported by python at all.
# http://bugs.python.org/issue17123
# - Setting OP_NO_COMPRESSION? The server doesn't yet.
# - Adding an ssl_context keyword argument to MongoClient? This might
# be useful for sites that have unusual requirements rather than
# trying to expose every SSLContext option through a keyword/uri
# parameter.