Skip to main content

base64_encode

Python API reference for the function encoding.base64_encode.

Public API

Function: base64_encode

Canonical path: encoding.base64_encode

Declared in: encoding.py

Signature

def base64_encode(string): ...

Summary

Base64 encode a string of bytes or text. The resulting bytes are safe to use in URLs.

Behavior

The function ensures the input is in bytes, encodes it using a URL-safe base64 method, and removes trailing equals signs.

Parameters

  • string: A string of bytes or text to be encoded.

Returns

  • Return value 1: The URL-safe base64 encoded result as bytes.