codrsquad / codrsquad/portable-python

requests: Can't connect to HTTPS URL because the SSL module is not available.

未关闭
#41 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
86
派生
13
PR 合并指标
30 天内没有已合并 PR

描述

I use this command to install the python3 by portable-python

yum install python3-pip
pip3 install portable-python

yum install -y libffi libffi-devel python3-devel openssl-devel
yum install -y perl-CPAN
cpan IPC::Cmd
cd /opt/
mkdir portable_with_openssl
cd portable_with_openssl/
portable-python build 3.11.7 -m openssl

mkdir /opt/versions
tar -C /opt/versions/  -xf dist/cpython-3.11.7-linux-x86_64.tar.gz
cd /opt/versions/3.11.7
./bin/python3.11 -mpip install requests

And after import the requests, i can request "http://google.com", but when i request "https://google.com", an error has occurred.

Python 3.11.7 (main, Mar 14 2024, 14:21:08) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>import requests
>>> requests.get("http://google.com")
<Response [200]>
>>> requests.get("https://google.com")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/urllib3/connectionpool.py", line 772, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/urllib3/connectionpool.py", line 295, in _get_conn
    return conn or self._new_conn()
                   ^^^^^^^^^^^^^^^^
  File "/opt/versions/3.11.7/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1063, in _new_conn
    raise ImportError(
ImportError: Can't connect to HTTPS URL because the SSL module is not available.

Does the requests library only use the SSL module in the system to process HTTPS requests?

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用 -m openssl 重现报告中针对 Python 3.11.7 的 portable-python 构建,然后在安装 requests 之前检查生成的解释器是否支持 SSL。比较报告中显示的 HTTP 和 HTTPS 命令,并确定该构建是否生成了可用的 SSL 模块;当 HTTPS 请求在打包后的解释器中能够正常工作时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。