Python HTTP 库 Requests 3.0 即将推出

栏目: 后端 · 前端 · 发布时间: 7年前

内容简介:知名 Python HTTP 库 Requests 作者 Kenneth Reitz 近日在 GitHub这里可以查看历史变更记录:Requests III 示例代码:

知名 Python HTTP 库 Requests 作者 Kenneth Reitz 近日在 GitHub 公布 了 Requests 的最新版本 3.0,不过 Requests III 仍在开发中,预计在 PyCon 2020 大会举办前发布首个可用版本。

这里可以查看历史变更记录: https://github.com/kennethreitz/requests3/blob/master/3.0-HISTORY.rst

Requests III 示例代码:

>>> from requests import HTTPSession

# Make a connection pool.
>>> http = HTTPSession()

# Make a request.
>>> r = http.request('get', 'https://httpbin.org/ip')

# View response data.
>>> r.json()
{'ip': '172.69.48.124'}

Requests III 支持发送 HTTP/1.1 &  HTTP/2 (wip) 请求,而无需向 URL 添加查询字符串,也无需对 POST 数据进行表单编码,Keep-alive 和 HTTP 连接池也是 100% 全自动进行。

Requests III 值得关注的新特性:

  • 支持 H11 & H2 协议
  • 针对所有面向公开 API 的类型注释(Type-annotations)
  • 提供更好的默认配置
  • async / await  关键字和对  asyncio  的支持
  • 兼容 Python 3.6+

Requests III 文档地址: https://3.python-requests.org/


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

Learning PHP 5

Learning PHP 5

David Sklar / O'Reilly / July, 2004 / $29.95

Learning PHP 5 is the ideal tutorial for graphic designers, bloggers, and other web crafters who want a thorough but non-intimidating way to understand the code that makes web sites dynamic. The book ......一起来看看 《Learning PHP 5》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具