twisted之http.clientエージェント

@implementer(IAgent)
 クラスエージェント(_AgentBase):
     デフ __init__ (自己反応器、
                 contextFactoryを = BrowserLikePolicyForHTTPS()、
                 のconnecttimeout =なし、は、bindaddress = なし、
                 プール = なし)
         なら ないIPolicyForHTTPS.providedBy(contextFactoryを):
            warnings.warn(
                repr(contextFactory) +
                 " はエージェントのHTTPSポリシーとして渡されましたが、" 
                " IPolicyForHTTPSを提供していません。Twisted14.0以降、" 
                "IPolicyForHTTPSのプロバイダーを渡します。" 
                stacklevel = 2、category = DeprecationWarning 
            contextFactory = _DeprecatedToCurrentPolicyForHTTPS(contextFactory)
        endpointFactory = _StandardEndpointFactory 
            reactor、contextFactory、connectTimeout、bindAddress)
        self._init(reactor、endpointFactory、pool)
    " "" 
        _AgentBase .__ init __(self、reactor、pool )
        self._endpointFactory = endpointFactory 

@implementer(IAgentEndpointFactory)class _StandardEndpointFactory(object):


@implementer(interfaces.IStreamClientEndpoint)class HostnameEndpoint(object): 
def resolveAddressesToEndpoints(addresses):
            #名前から解決されたすべてのアドレスのエンドポイントを生成します。
            アドレス内のeachAddressの
                場合if isinstance(eachAddress、IPv6Address):
                    yield TCP6ClientEndpoint(
                        self._reactor、eachAddress.host、eachAddress.port、
                        self._timeout、self._bindAddress 
                if isinstance(eachAddress、IPv4Address):yield TCP4ClientEndpoint(
                        self._timeout 、self._bindAddress


                     
                        self._reactor 、eachAddress.host、eachAddress.port、

 

 エージェントはブラウザに相当し、エージェントのリクエストメソッドはリクエストを完了します。リクエストは最初にDNSを作成し、tcp4clientendpoint(reactor.connectTCP())を生成します

おすすめ

転載: www.cnblogs.com/pyhai/p/12682108.html