requests 如何编码 multipart/form-data

requests 是用 python 处理 HTTP 请求时毋庸置疑的第一选择,其中的一个原因就是它简洁的 API 接口。那么这些接口下面隐藏的是什么样的东东呢,今天我们来分析一下 requests 是如何处理 multipart/form-data 格式的请求的。 ...

October 9, 2017

HTTP for Human: 深入研究 Requests

这是一篇学习 Requests 的随笔. Python 回顾 bytearray是一个字节数组, 数组的内容是可变的, 数组中的每一个元素都是 [0, 256)之间的整数 定义为: bytearray([source[, encoding[, errors]]]) 其中source参数有几种情况: If it is a string, you must also give the encoding (and optionally, errors) parameters; bytearray() then converts the string to bytes using str.encode(). If it is an integer, the array will have that size and will be initialized with null bytes. If it is an object conforming to the buffer interface, a read-only buffer of the object will be used to initialize the bytes array....