【问题标题】:How to use Python HTTP2 reuqest?如何使用 Python HTTP 2 请求?
【发布时间】:2021-05-26 10:42:00
【问题描述】:

Python3中如何使用http2请求?

import requests

x = requests.get('https://w3schools.com/python/demopage.htm')

print(x.text)

我认为在这段代码中我使用的是 HTTP1 协议

【问题讨论】:

  • 有问题吗?有任何错误信息吗?会发生什么?

标签: python python-3.x python-requests


【解决方案1】:

你可以使用 hyper 来做到这一点。

from hyper import HTTPConnection

x = HTTPConnection('https://w3schools.com/python/demopage.htm')
x.request('GET', '/get')
ans = conn.get_response()

print(ans.read())

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-11
    • 2011-05-24
    • 2020-12-02
    • 2016-04-06
    • 1970-01-01
    相关资源
    最近更新 更多