I just want to send a post request to submit a form to a website who only use h2 protocol.
import requests
from hyper.contrib import HTTP20Adapter
import hyper
session = requests.session()
session.mount(url, HTTP20Adapter())
r = session.post(url, data=payload, headers=header)
print(r.text)
This doesn't seem to work. And since Hyper documentation is pretty empty. I needed some external help.
Thank you in advance
答案 0 :(得分:0)
我认为这是hyper
库中的错误(已通过Release v0.7.0.
测试)。我对原始hyper
库有同样的问题,必须设置Content-Length
查询头。没有此标头hyper
,HTTP / 2不会发送查询主体。使用HTTP / 1.1时,无需设置Content-Length
标头即可正常工作。