本文整理匯總了Python中twisted.web.client.HTTPClientFactory.host方法的典型用法代碼示例。如果您正苦於以下問題:Python HTTPClientFactory.host方法的具體用法?Python HTTPClientFactory.host怎麽用?Python HTTPClientFactory.host使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twisted.web.client.HTTPClientFactory
的用法示例。
在下文中一共展示了HTTPClientFactory.host方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _start
# 需要導入模塊: from twisted.web.client import HTTPClientFactory [as 別名]
# 或者: from twisted.web.client.HTTPClientFactory import host [as 別名]
def _start(self):
self.saved['Request URL'] = self.request_url
# Generate a request id if possible
if uuid:
request_id = str(uuid.uuid1())
self.saved['Request ID'] = request_id
self.headers['X-Request-Id'] = request_id
factory = HTTPClientFactory(url=self.conf['path'],
method=self.conf['method'], postdata=self.conf['data'],
headers=self.headers, agent=self.agent,
timeout=self.conf['timeout'], followRedirect=0)
factory.host = self.headers_host
factory.noisy = False
factory.deferred.addErrback(self._failure_tcp)
factory.deferred.addErrback(self._failure_http)
self._connect(factory)
return factory.deferred