python中使用requests模块请求https的网站报错-问答-阿里云开发者社区-阿里云

开发者社区> 睡着了去做梦> 正文

python中使用requests模块请求https的网站报错

2021-10-19 12:39:21 186 1

代码如下


import requests

print(requests.get("https://www.baidu.com"))

错误提示如下,是什么原因造成的

Traceback (most recent call last):
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/urllib3/connectionpool.py", line 588, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/urllib3/connectionpool.py", line 250, in _get_conn
    return conn or self._new_conn()
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/urllib3/connectionpool.py", line 821, in _new_conn
    raise SSLError("Can't connect to HTTPS URL because the SSL "
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jiangyd/PycharmProjects/untitled10/mm.py", line 12, in <module>
    print(requests.get("https://www.baidu.com"))
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.
取消 提交回答
全部回答(1)
  • 无敌小将
    2021-10-19 16:35:17

    您好,请安装ssl相关模块(Py3)

    pip install pyopenssl
    
    1 0
相关问答

11

回答

iphone设置阿里云邮箱的步骤

minioba 2013-04-24 22:04:37 101714浏览量 回答数 11

22

回答

爬虫数据管理【问答合集】

我是管理员 2018-08-10 16:37:41 146784浏览量 回答数 22

57

回答

为阿里云ECS(CentOS7)配置IPv6隧道地址

dongshan8 2016-06-17 13:51:32 104439浏览量 回答数 57

42

回答

【精品问答集锦】Python热门问题

小六码奴 2019-05-30 15:27:34 135561浏览量 回答数 42

38

回答

安全组详解,新手必看教程

我的中国 2017-11-30 15:23:46 256872浏览量 回答数 38

103

回答

为阿里云ECS(Windows 2012)创建IPv6隧道地址

dongshan8 2016-06-09 16:40:16 101447浏览量 回答数 103

249

回答

阿里云LNAMP(Linux + Nginx + Apache + MySQL + PHP)环境一键安装脚本

云代维 2014-02-14 15:26:06 302605浏览量 回答数 249

8

回答

mail.aliyun.com邮箱android手机客户端设置方法

jack_yang 2013-04-24 09:01:34 122082浏览量 回答数 8

24

回答

【精品问答】python技术1000问(1)

问问小秘 2019-11-15 13:25:00 471425浏览量 回答数 24

37

回答

【云服务器教程征集令】这个六一阿里云邀您来吐槽!

fanyue88888 2012-06-01 18:55:41 113745浏览量 回答数 37
29
文章
996
问答
推荐问答
相关电子书
更多
文娱运维技术
立即下载
《SaaS模式云原生数据仓库应用场景实践》
立即下载
《看见新力量:二》电子书
立即下载