python类packages()的实例源码

_session.py 文件源码 项目:python-zhmcclient 作者: zhmcclient 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def _new_session(retry_timeout_config):
        """
        Return a new `requests.Session` object.
        """
        retry = requests.packages.urllib3.Retry(
            total=None,
            connect=retry_timeout_config.connect_retries,
            read=retry_timeout_config.read_retries,
            method_whitelist=retry_timeout_config.method_whitelist,
            redirect=retry_timeout_config.max_redirects)
        session = requests.Session()
        session.mount('https://',
                      requests.adapters.HTTPAdapter(max_retries=retry))
        session.mount('http://',
                      requests.adapters.HTTPAdapter(max_retries=retry))
        return session
test_requests.py 文件源码 项目:ruffruffs 作者: di 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def test_urllib3_retries(httpbin):
    from requests.packages.urllib3.util import Retry
    s = requests.Session()
    s.mount('http://', HTTPAdapter(max_retries=Retry(
        total=2, status_forcelist=[500]
    )))

    with pytest.raises(RetryError):
        s.get(httpbin('status/500'))
test_requests.py 文件源码 项目:ruffruffs 作者: di 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_vendor_aliases():
    from requests.packages import urllib3
    from requests.packages import chardet

    with pytest.raises(ImportError):
        from requests.packages import webbrowser
test_requests.py 文件源码 项目:filegardener 作者: smorin 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_urllib3_retries(httpbin):
    from requests.packages.urllib3.util import Retry
    s = requests.Session()
    s.mount('http://', HTTPAdapter(max_retries=Retry(
        total=2, status_forcelist=[500]
    )))

    with pytest.raises(RetryError):
        s.get(httpbin('status/500'))
test_requests.py 文件源码 项目:filegardener 作者: smorin 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_vendor_aliases():
    from requests.packages import urllib3
    from requests.packages import chardet

    with pytest.raises(ImportError):
        from requests.packages import webbrowser
test_requests.py 文件源码 项目:filegardener 作者: smorin 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_urllib3_retries(httpbin):
    from requests.packages.urllib3.util import Retry
    s = requests.Session()
    s.mount('http://', HTTPAdapter(max_retries=Retry(
        total=2, status_forcelist=[500]
    )))

    with pytest.raises(RetryError):
        s.get(httpbin('status/500'))
test_requests.py 文件源码 项目:filegardener 作者: smorin 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_vendor_aliases():
    from requests.packages import urllib3
    from requests.packages import chardet

    with pytest.raises(ImportError):
        from requests.packages import webbrowser
test_requests.py 文件源码 项目:Codeforces-Sublime-Plugin 作者: karunk 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_urllib3_retries(httpbin):
    from requests.packages.urllib3.util import Retry
    s = requests.Session()
    s.mount('http://', HTTPAdapter(max_retries=Retry(
        total=2, status_forcelist=[500]
    )))

    with pytest.raises(RetryError):
        s.get(httpbin('status/500'))
test_requests.py 文件源码 项目:Codeforces-Sublime-Plugin 作者: karunk 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def test_vendor_aliases():
    from requests.packages import urllib3
    from requests.packages import chardet

    with pytest.raises(ImportError):
        from requests.packages import webbrowser


问题


面经


文章

微信
公众号

扫码关注公众号