【问题标题】:Socket error in PythonPython中的套接字错误
【发布时间】:2015-09-12 18:55:28
【问题描述】:

从 python 连接到任何站点时出现套接字错误。但是,当我使用 curl 对 -k 执行相同操作时,我可以连接。我是 python 新手,如何在 python 中禁用 ssl 验证器?对我来说,这似乎与 ssl 有关。这是我在这里提出的 https 请求。

 >>> sock.bind(server_address)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.gaierror: [Errno 11001] getaddrinfo failed

【问题讨论】:

  • import socket;socket.getaddrinfo('the url you are trying to get', 443) 是做什么的?我在本地尝试过,但出现错误,除非我删除 http:// 或 https://

标签: python python-2.7 curl websocket


【解决方案1】:

首先你必须导入 Socket 模块。然后使用函数 getaddrinfor()。

【讨论】:

猜你喜欢
  • 2018-10-30
  • 2011-02-22
  • 2014-03-30
  • 1970-01-01
  • 2021-10-21
  • 2012-10-30
  • 2016-05-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多