mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
#3613: add base64.encodebytes and decodebytes as the new spelling of encodestring and decodestring; deprecate the latter.
This commit is contained in:
parent
cef803f82c
commit
b54d801280
6 changed files with 66 additions and 48 deletions
|
@ -419,11 +419,11 @@ class Binary:
|
|||
return self.data != other
|
||||
|
||||
def decode(self, data):
|
||||
self.data = base64.decodestring(data)
|
||||
self.data = base64.decodebytes(data)
|
||||
|
||||
def encode(self, out):
|
||||
out.write("<value><base64>\n")
|
||||
encoded = base64.encodestring(self.data)
|
||||
encoded = base64.encodebytes(self.data)
|
||||
out.write(encoded.decode('ascii'))
|
||||
out.write('\n')
|
||||
out.write("</base64></value>\n")
|
||||
|
@ -1100,7 +1100,7 @@ class Transport:
|
|||
if auth:
|
||||
import base64
|
||||
auth = urllib.parse.unquote_to_bytes(auth)
|
||||
auth = base64.encodestring(auth).decode("utf-8")
|
||||
auth = base64.encodebytes(auth).decode("utf-8")
|
||||
auth = "".join(auth.split()) # get rid of whitespace
|
||||
extra_headers = [
|
||||
("Authorization", "Basic " + auth)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue