python-requests支持HTTP2和异步调用吗?

问题描述 投票:0回答:2

我想在我的服务器中使用 python-requests 向 Apple 推送服务器发送推送通知,我的问题:

  1. python-requests 支持异步调用吗?
  2. python-request支持HTTP2吗?
asynchronous python-requests http2
2个回答
9
投票

正如@qris在此评论中所推荐的,您应该考虑使用HTTPXhttps://github.com/encode/httpx/)。

目前处于测试阶段,但计划发布 1.0 版本

它支持异步和 HTTP/2,并提供与请求兼容的 API。


1
投票
http://docs.python-requests.org/en/master/

):

Requests 允许您发送有机的、草饲的 HTTP/1.1 请求,而不需要体力劳动。

但是如果你需要发送HTTP/2请求,你可以尝试
Hyper

https://hyper.readthedocs.io/en/latest/

hyper 支持 Python 3.4 和 Python 2.7.9,并且可以使用 HTTP/2 和 HTTP/1.1。

© www.soinside.com 2019 - 2024. All rights reserved.