当前位置: 首页>>代码示例>>Python>>正文


Python Agent.__init__方法代码示例

本文整理汇总了Python中twisted.web.client.Agent.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.__init__方法的具体用法?Python Agent.__init__怎么用?Python Agent.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.web.client.Agent的用法示例。


在下文中一共展示了Agent.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twisted.web.client import Agent [as 别名]
# 或者: from twisted.web.client.Agent import __init__ [as 别名]
 def __init__(self, uuid, token, cert_file, throttling=False):
     self._uuid = uuid
     self._token = None
     self._creds = None
     self.set_token(token)
     factory = getPolicyForHTTPS(cert_file)
     pool = self._get_pool()
     _Agent.__init__(self, reactor, contextFactory=factory, pool=pool)
开发者ID:leapcode,项目名称:soledad,代码行数:10,代码来源:_http.py

示例2: __init__

# 需要导入模块: from twisted.web.client import Agent [as 别名]
# 或者: from twisted.web.client.Agent import __init__ [as 别名]
  def __init__(self, gerrit_host, *args, **kwargs):
    url_parts = urlparse.urlparse(gerrit_host)
    if url_parts.scheme:
      self.gerrit_protocol = url_parts.scheme
    self.gerrit_host = url_parts.netloc

    auth_entry = NETRC.authenticators(self.gerrit_host.partition(':')[0])
    if auth_entry:
      self.auth_token = 'Basic %s' % (
          base64.b64encode('%s:%s' % (auth_entry[0], auth_entry[2])))
    else:
      self.auth_token = None
    Agent.__init__(self, reactor, *args, **kwargs)
开发者ID:leiferikb,项目名称:bitpop,代码行数:15,代码来源:gerrit_agent.py

示例3: __init__

# 需要导入模块: from twisted.web.client import Agent [as 别名]
# 或者: from twisted.web.client.Agent import __init__ [as 别名]
    def __init__(self, reactor,
                 connectTimeout=None, bindAddress=None,
                 pool=None, torSocksHostname=None, torSocksPort=None, isolationMode=None):
        """
        Create a L{TorAgent}.

        @param reactor: A provider of
            L{twisted.internet.interfaces.IReactorTCP}
            to place outgoing connections.
        @type reactor: L{twisted.internet.interfaces.IReactorTCP}.

        @param connectTimeout: The amount of time that this L{Agent} will wait
            for the peer to accept a connection.
        @type connectTimeout: L{float}

        @param bindAddress: The local address for client sockets to bind to.
        @type bindAddress: L{bytes}

        @param pool: An L{HTTPConnectionPool} instance, or C{None}, in which
            case a non-persistent L{HTTPConnectionPool} instance will be
            created.
        @type pool: L{HTTPConnectionPool}

        @param torSocksHostname: A C{str} giving the tor SOCKS hostname
            that this TorAgent will use for outbound Tor connections.

        @param torSocksPort: An C{int} giving the SOCKS port number that will be used
            for outbound Tor connections.

        @param isolationMode: A Tor circuit isolation mode:
        - monoCircuit means always let tor process decide which circuit to use
        - circuitPerAgent means always use one tor circuit per agent instance
        """
        Agent.__init__(self, reactor,connectTimeout=None, bindAddress=None, pool=None)

        self._connectTimeout = connectTimeout
        self._bindAddress = bindAddress

        self.torSocksHostname = torSocksHostname
        self.torSocksPort = torSocksPort

        if isolationMode in self.isolationModes:
            self.isolationMode = isolationMode
            if isolationMode == 'circuitPerAgent':
                self.username, self.password = self._genRandomUserPass()
        else:
            raise TorAgentCircuitIsolationModeNotSupported("Unsupported mode: %r" % (isolationMode,))
开发者ID:EricSchles,项目名称:txtorhttpproxy,代码行数:49,代码来源:agent.py

示例4: __init__

# 需要导入模块: from twisted.web.client import Agent [as 别名]
# 或者: from twisted.web.client.Agent import __init__ [as 别名]
	def __init__(self, *args, **kwargs):
		Agent.__init__(self, *args, **kwargs)
开发者ID:ComputerNetworks-UFRGS,项目名称:ManP2P-ng,代码行数:4,代码来源:httpdtn.py

示例5: __init__

# 需要导入模块: from twisted.web.client import Agent [as 别名]
# 或者: from twisted.web.client.Agent import __init__ [as 别名]
 def __init__(self, reactor, path, **kwargs):
     self.path = path
     Agent.__init__(self, reactor, **kwargs)
开发者ID:calston,项目名称:tensor,代码行数:5,代码来源:utils.py

示例6: __init__

# 需要导入模块: from twisted.web.client import Agent [as 别名]
# 或者: from twisted.web.client.Agent import __init__ [as 别名]
   def __init__(self, reactor, contextFactory = WebClientContextFactory(),
                connectTimeout = None, bindAddress = None):
      Agent.__init__(self, reactor, contextFactory)

      self._connectTimeout = connectTimeout
      self._bindAddress = bindAddress
开发者ID:flowroute,项目名称:twisted-suds,代码行数:8,代码来源:twisted_transport.py


注:本文中的twisted.web.client.Agent.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。