當前位置: 首頁>>代碼示例>>Python>>正文


Python PipSession.timeout方法代碼示例

本文整理匯總了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
開發者ID:1check1,項目名稱:my-second-blog,代碼行數:37,代碼來源:basecommand.py

示例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
開發者ID:iCart,項目名稱:pip-utils,代碼行數:37,代碼來源:outdated.py

示例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
開發者ID:bobobo1618,項目名稱:heroku-buildpack-python,代碼行數:33,代碼來源:basecommand.py

示例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
開發者ID:EnviroCentre,項目名稱:jython-upgrade,代碼行數:28,代碼來源:basecommand.py

示例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
開發者ID:abhi1one,項目名稱:db-webcrawler,代碼行數:17,代碼來源:run_package_crawler.py


注:本文中的pip.download.PipSession.timeout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。