本文整理汇总了Python中pip.download.PipSession.timeout方法的典型用法代码示例。如果您正苦于以下问题:Python PipSession.timeout方法的具体用法?Python PipSession.timeout怎么用?Python PipSession.timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip.download.PipSession
的用法示例。
在下文中一共展示了PipSession.timeout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_session
# 需要导入模块: from pip.download import PipSession [as 别名]
# 或者: from pip.download.PipSession import timeout [as 别名]
def _build_session(self, options, retries=None, timeout=None):
session = PipSession(
cache=(
normalize_path(os.path.join(options.cache_dir, "http"))
if options.cache_dir else None
),
retries=retries if retries is not None else options.retries,
insecure_hosts=options.trusted_hosts,
)
# Handle custom ca-bundles from the user
if options.cert:
session.verify = options.cert
# Handle SSL client certificate
if options.client_cert:
session.cert = options.client_cert
# Handle timeouts
if options.timeout or timeout:
session.timeout = (
timeout if timeout is not None else options.timeout
)
# Handle configured proxies
if options.proxy:
session.proxies = {
"http": options.proxy,
"https": options.proxy,
}
# Determine if we can prompt the user for authentication or not
session.auth.prompting = not options.no_input
return session
示例2: _build_session
# 需要导入模块: from pip.download import PipSession [as 别名]
# 或者: from pip.download.PipSession import timeout [as 别名]
def _build_session(options, retries=None, timeout=None):
session = PipSession(
cache=(
normalize_path(os.path.join(options.get('cache_dir'), 'http'))
if options.get('cache_dir') else None
),
retries=retries if retries is not None else options.get('retries'),
insecure_hosts=options.get('trusted_hosts'),
)
# Handle custom ca-bundles from the user
if options.get('cert'):
session.verify = options.get('cert')
# Handle SSL client certificate
if options.get('client_cert'):
session.cert = options.get('client_cert')
# Handle timeouts
if options.get('timeout') or timeout:
session.timeout = (
timeout if timeout is not None else options.get('timeout')
)
# Handle configured proxies
if options.get('proxy'):
session.proxies = {
'http': options.get('proxy'),
'https': options.get('proxy'),
}
# Determine if we can prompt the user for authentication or not
session.auth.prompting = not options.get('no_input')
return session
示例3: _build_session
# 需要导入模块: from pip.download import PipSession [as 别名]
# 或者: from pip.download.PipSession import timeout [as 别名]
def _build_session(self, options):
session = PipSession(
cache=normalize_path(os.path.join(options.cache_dir, "http")),
retries=options.retries,
)
# Handle custom ca-bundles from the user
if options.cert:
session.verify = options.cert
elif options.no_check_certificate:
session.verify = False
# Handle SSL client certificate
if options.client_cert:
session.cert = options.client_cert
# Handle timeouts
if options.timeout:
session.timeout = options.timeout
# Handle configured proxies
if options.proxy:
session.proxies = {
"http": options.proxy,
"https": options.proxy,
}
# Determine if we can prompt the user for authentication or not
session.auth.prompting = not options.no_input
return session
示例4: _build_session
# 需要导入模块: from pip.download import PipSession [as 别名]
# 或者: from pip.download.PipSession import timeout [as 别名]
def _build_session(self, options):
session = PipSession(retries=options.retries)
# Handle custom ca-bundles from the user
if options.cert:
session.verify = options.cert
# Handle SSL client certificate
if options.client_cert:
session.cert = options.client_cert
# Handle timeouts
if options.timeout:
session.timeout = options.timeout
# Handle configured proxies
if options.proxy:
session.proxies = {
"http": options.proxy,
"https": options.proxy,
}
# Determine if we can prompt the user for authentication or not
session.auth.prompting = not options.no_input
return session
示例5: get_versions
# 需要导入模块: from pip.download import PipSession [as 别名]
# 或者: from pip.download.PipSession import timeout [as 别名]
def get_versions(package):
host = "https://pypi.python.org/simple/"
url = urlparse.urljoin(host, package)
url = url + '/'
session = PipSession()
session.timeout = 15
session.auth.prmpting = True
pf = PackageFinder(find_links=[], index_urls=host, use_wheel=True, allow_external=[], allow_unverified=[], allow_all_external=False, allow_all_prereleases=False, process_dependency_links=False, session=session,)
location = [Link(url, trusted=True)]
req = InstallRequirement.from_line(package, None)
versions = []
for page in pf._get_pages(location, req):
versions = versions + [version for _, _, version in pf._package_versions(page.links, package)]
return versions