base64_decode
Python API reference for the function encoding.base64_decode.
Public API
Function: base64_decode
Canonical path: encoding.base64_decode
Declared in: encoding.py
Signature
def base64_decode(string): ...
Summary
Base64 decode a URL-safe string of bytes or text. The result is bytes.
Behavior
The function converts the input to bytes using ASCII encoding and ignoring errors, appends necessary padding, and attempts to decode it using a URL-safe base64 method.
Parameters
- string: A URL-safe string of bytes or text to be decoded.
Returns
- Return value 1: The decoded result as bytes.
Errors
Raises BadData if the input is invalid base64-encoded data, which may occur during a TypeError or ValueError.