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 converts the input to bytes, encodes it using a URL-safe base64 algorithm, and strips trailing padding characters.

Parameters

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

Returns

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