IOpenSSLTrustRoot - API.
, . , , , .
, , Twisted , , - , , .
- , , , , , , Twisted listing , , , .
, , . Twisted , . .
:
from zope.interface import implementer
from characteristic import attributes
from twisted.internet._sslverify import IOpenSSLTrustRoot
@implementer(IOpenSSLTrustRoot)
@attributes(["root_certificate_path"])
class MyCATrustRoot(object):
def _addCACertsToContext(self, context):
context.load_verify_locations(self.root_certificate_path)
MyCATrustRoot trustRoot BrowserLikePolicyForHTTPS. , Twisted 14.0.2, trustRoot, BrowserLikePolicyForHTTPS.
, "CA" /foo/ca.pem:
from twisted.web.client import BrowserLikePolicyForHTTPS, Agent
from twisted.internet import reactor
agent = Agent(reactor, BrowserLikePolicyForHTTPS(
MyCATrustRoot(root_certificate_path="/foo/ca.pem")))