F:\ancode\lib\site-packages\urllib3\connectionpool.py in _make_request geopy包错误

timeout                                   Traceback (most recent call last)
F:\ancode\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    342         try:
--> 343             self._validate_conn(conn)
    344         except (SocketTimeout, BaseSSLError) as e:

F:\ancode\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
    848         if not getattr(conn, 'sock', None):  # AppEngine might not have  `.sock`
--> 849             conn.connect()
    850 

F:\ancode\lib\site-packages\urllib3\connection.py in connect(self)
    355             server_hostname=hostname,
--> 356             ssl_context=context)
    357 

F:\ancode\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir)
    358         if HAS_SNI and server_hostname is not None:
--> 359             return context.wrap_socket(sock, server_hostname=server_hostname)
    360 

F:\ancode\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    411             context=self,
--> 412             session=session
    413         )

F:\ancode\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
    849                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 850                     self.do_handshake()
    851             except (OSError, ValueError):

F:\ancode\lib\ssl.py in do_handshake(self, block)
   1107                 self.settimeout(None)
-> 1108             self._sslobj.do_handshake()
   1109         finally:

timeout: _ssl.c:1029: The handshake operation timed out

运行程序遇到的错误,一开始在网上搜各种解决方法,把很多包卸了重装发现都解决不了,鼓弄了一下午,后来发现不是安装包的问题,因为我把环境从anaconda换成python3.10还是出现一样的错误,最后发现都是request请求出错,我甚至还把connectionpool的文件替换掉,改了里面报错的函数,也没有用,后来发现因为自己调用了geopy包,需要获得地理位置,于是在里面加了timeout之后发现问题就没有了,自己真是一个大傻缺

geolocator.geocode(x,timeout=100).latitude 在里面加一个时延
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值