MCPcopy
hub / github.com/django/django / urlsafe_base64_encode

Function urlsafe_base64_encode

django/utils/http.py:180–185  ·  view source on GitHub ↗

Encode a bytestring to a base64 string for use in URLs. Strip any trailing equal signs.

(s)

Source from the content-addressed store, hash-verified

178
179
180def urlsafe_base64_encode(s):
181 """
182 Encode a bytestring to a base64 string for use in URLs. Strip any trailing
183 equal signs.
184 """
185 return base64.urlsafe_b64encode(s).rstrip(b"\n=").decode("ascii")
186
187
188def urlsafe_base64_decode(s):

Calls 1

decodeMethod · 0.45