如何在请求中定义 HTTP 协议版本? [英] How to define the HTTP protocol version in requests?

查看:85
本文介绍了如何在请求中定义 HTTP 协议版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import requests  
requests.get("http://www.sample.com")

如何修改参数以发送如下请求:

How to modifiy the parameter to send the requests like below:

获取 www.sample.com HTTP/1.0"

"GET www.sample.com HTTP/1.0"

获取 www.sample.com HTTP/1.1"

"GET www.sample.com HTTP/1.1"

推荐答案

Requests 不支持发送 HTTP/1.0 消息.很难理解您为什么需要这样做:HTTP/1.1 最初是在 1999 年 6 月发布的 RFC 2616 中指定的.因此 HTTP/1.0 已经过时超过 16 年:现代工具基本上不支持 HTTP/1.0 不再.

Requests does not support sending HTTP/1.0 messages. It is hard to understand why you'd need to do that: HTTP/1.1 was originally specified in RFC 2616, published in June 1999. HTTP/1.0 has therefore been obsolete for more than 16 years: modern tools largely do not support HTTP/1.0 any longer.

这篇关于如何在请求中定义 HTTP 协议版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆