本文整理匯總了Python中twisted.web.client.HTTPClientFactory.path方法的典型用法代碼示例。如果您正苦於以下問題:Python HTTPClientFactory.path方法的具體用法?Python HTTPClientFactory.path怎麽用?Python HTTPClientFactory.path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twisted.web.client.HTTPClientFactory
的用法示例。
在下文中一共展示了HTTPClientFactory.path方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getPage
# 需要導入模塊: from twisted.web.client import HTTPClientFactory [as 別名]
# 或者: from twisted.web.client.HTTPClientFactory import path [as 別名]
def getPage(url, contextFactory=None, *args, **kwargs):
url = str(url)
scheme, host, port, path = _parse(url)
factory = HTTPClientFactory(url, *args, **kwargs)
if False: # use a proxy
host, port = 'proxy', 6060
factory.path = url
if scheme == 'https':
from twisted.internet import ssl
if contextFactory is None:
contextFactory = ssl.ClientContextFactory()
reactor.connectSSL(host, port, factory, contextFactory)
else:
reactor.connectTCP(host, port, factory)
return factory.deferred