zoukankan      html  css  js  c++  java
  • 爬虫 requests ValueError: check_hostname requires server_hostname

    C:Python37python3.exe D:/shannanai_spider/crawler_algorithm/test.py
    Traceback (most recent call last):
    File "D:/shannanai_spider/crawler_algorithm/test.py", line 40, in <module>
    spider()
    File "D:/shannanai_spider/crawler_algorithm/test.py", line 35, in spider
    res = session.get(url=url,headers=headers,verify=False).text
    File "C:Python37libsite-packages equestssessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
    File "C:Python37libsite-packages equestssessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
    File "C:Python37libsite-packages equestssessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
    File "C:Python37libsite-packages equestsadapters.py", line 449, in send
    timeout=timeout
    File "C:Python37libsite-packagesurllib3connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
    File "C:Python37libsite-packagesurllib3connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
    File "C:Python37libsite-packagesurllib3connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
    File "C:Python37libsite-packagesurllib3connection.py", line 506, in _connect_tls_proxy
    ssl_context=ssl_context,
    File "C:Python37libsite-packagesurllib3utilssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
    File "C:Python37libsite-packagesurllib3utilssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
    File "C:Python37libssl.py", line 412, in wrap_socket
    session=session
    File "C:Python37libssl.py", line 810, in _create
    raise ValueError("check_hostname requires server_hostname")
    ValueError: check_hostname requires server_hostname

    Process finished with exit code 1

    解决方案:

      pip3 install  urllib3==1.25.11

    如果觉得对您有帮助,麻烦您点一下推荐,谢谢!



    好记忆不如烂笔头
  • 相关阅读:
    捉BUG记(To Catch a Bug)
    发布一个简单的knockout-easyui绑定库
    笔记:Hyper-V上Centos 6.5分辨率调整问题解决笔记
    Asp.net中HttpRequest.Params与Reques.Item之异同
    Oracle必须死之奇怪的ORA-06502错误
    centos7 搭建bitcoin/usdt 节点服务
    webpack安装配置
    centos7 rsyslog
    nginx+fpm 开机自启
    centos7下 PHP添加pdo_myql扩展
  • 原文地址:https://www.cnblogs.com/xuchunlin/p/14781735.html
Copyright © 2011-2022 走看看