Skip to main content

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 ensures the input is bytes using ASCII encoding, appends necessary padding, and attempts to decode 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 data as bytes.

Errors

Raises BadData if the input is invalid base64-encoded data.