Update vendored requests to 2.25.1

Updates certifi to 2021.5.30
Updates chardet to 4.0.0
Updates idna to 2.10
Updates urllib3 to 1.26.13
This commit is contained in:
Labrys of Knossos 2022-11-28 19:16:35 -05:00
commit 501be2c479
81 changed files with 38530 additions and 4957 deletions

View file

@ -1,15 +1,15 @@
from __future__ import absolute_import
import binascii
import codecs
import os
from io import BytesIO
from .fields import RequestField
from .packages import six
from .packages.six import b
from .fields import RequestField
writer = codecs.lookup('utf-8')[3]
writer = codecs.lookup("utf-8")[3]
def choose_boundary():
@ -17,8 +17,8 @@ def choose_boundary():
Our embarrassingly-simple replacement for mimetools.choose_boundary.
"""
boundary = binascii.hexlify(os.urandom(16))
if six.PY3:
boundary = boundary.decode('ascii')
if not six.PY2:
boundary = boundary.decode("ascii")
return boundary
@ -76,7 +76,7 @@ def encode_multipart_formdata(fields, boundary=None):
boundary = choose_boundary()
for field in iter_field_objects(fields):
body.write(b('--%s\r\n' % (boundary)))
body.write(b("--%s\r\n" % (boundary)))
writer(body).write(field.render_headers())
data = field.data
@ -89,10 +89,10 @@ def encode_multipart_formdata(fields, boundary=None):
else:
body.write(data)
body.write(b'\r\n')
body.write(b"\r\n")
body.write(b('--%s--\r\n' % (boundary)))
body.write(b("--%s--\r\n" % (boundary)))
content_type = str('multipart/form-data; boundary=%s' % boundary)
content_type = str("multipart/form-data; boundary=%s" % boundary)
return body.getvalue(), content_type