urllib3/urllib3

GitHub: urllib3/urllib3

Python 生态中功能完备的底层 HTTP 客户端库,为上层框架和应用提供连接池、线程安全及丰富的请求控制能力。

Stars: 4020 | Forks: 1326

![urllib3](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/852ad875da150622.svg)

PyPI Version Python Versions Join our Discord Coverage Status Build Status on GitHub Documentation Status
OpenSSF Scorecard SLSA 3 CII Best Practices

urllib3 是一个功能强大且*用户友好*的 Python HTTP 客户端。 urllib3 提供了许多 Python 标准库中缺失的关键特性: - 线程安全。 - 连接池。 - 客户端 SSL/TLS 验证。 - 支持 multipart 编码的文件上传。 - 用于重试请求和处理 HTTP 重定向的辅助工具。 - 支持 gzip、deflate、brotli 和 zstd 编码。 - 支持 HTTP 和 SOCKS 代理。 - 100% 的测试覆盖率。 ……以及许多其他特性,但最重要的是:我们的维护者拥有 15 年以上的经验,一直以最高的代码标准和对安全性的高度重视来维护 urllib3。 [Python 生态系统的大部分已经在使用 urllib3](https://urllib3.readthedocs.io/en/stable/#who-uses),你也应该如此。 ## 安装 可以使用 [pip](https://pip.pypa.io) 安装 urllib3: ``` $ python -m pip install urllib3 ``` 或者,你也可以从 [GitHub](https://github.com/urllib3/urllib3) 获取最新的源代码: ``` $ git clone https://github.com/urllib3/urllib3.git $ cd urllib3 $ pip install . ``` ## 入门指南 urllib3 易于使用: ``` >>> import urllib3 >>> resp = urllib3.request("GET", "http://httpbin.org/robots.txt") >>> resp.status 200 >>> resp.data b"User-agent: *\nDisallow: /deny\n" ``` urllib3 在 [urllib3.readthedocs.io](https://urllib3.readthedocs.io) 提供了使用说明和参考文档。 ## 安全披露 如需报告安全漏洞,请使用 [Tidelift 安全联系方式](https://tidelift.com/security)。 Tidelift 将与维护者协调修复和披露事宜。 ## 维护者 认识一下我们自 2008 年以来的维护者: - 现任负责人:[@illia-v](https://github.com/illia-v) (Illia Volochii) - [@sethmlarson](https://github.com/sethmlarson) (Seth M. Larson) - [@pquentin](https://github.com/pquentin) (Quentin Pradet) - [@theacodes](https://github.com/theacodes) (Thea Flowers) - [@haikuginger](https://github.com/haikuginger) (Jess Shapiro) - [@lukasa](https://github.com/lukasa) (Cory Benfield) - [@sigmavirus24](https://github.com/sigmavirus24) (Ian Stapleton Cordasco) - [@shazow](https://github.com/shazow) (Andrey Petrov) 👋 ## 赞助 如果您的公司从这个库中受益,请考虑[赞助它的开发](https://urllib3.readthedocs.io/en/latest/sponsors.html)。 ## 企业版 urllib3 的专业支持可作为 [Tidelift 订阅][1] 的一部分获取。Tidelift 为软件开发团队提供了一个单一来源,用于购买和维护他们的软件,并由最了解它的专家提供专业级的保证,同时与现有工具无缝集成。
标签:API请求, PyPI, Python, SSL/TLS, Syscall, urllib3, URL抓取, Web开发, 代理支持, 内核驱动, 功能组件, 后端开发, 告警, 多线程安全, 开源库, 搜索引擎爬虫, 数据抓取, 文件上传, 无后门, 网络协议, 网络请求库, 网络通信, 连接池, 逆向工具, 重试机制