MCPcopy
hub / github.com/django/django / urlsafe_base64_decode

Function urlsafe_base64_decode

django/utils/http.py:188–197  ·  view source on GitHub ↗

Decode a base64 encoded string. Add back any trailing equal signs that might have been stripped.

(s)

Source from the content-addressed store, hash-verified

186
187
188def urlsafe_base64_decode(s):
189 """
190 Decode a base64 encoded string. Add back any trailing equal signs that
191 might have been stripped.
192 """
193 s = s.encode()
194 try:
195 return base64.urlsafe_b64decode(s.ljust(len(s) + len(s) % 4, b"="))
196 except (LookupError, BinasciiError) as e:
197 raise ValueError(e)
198
199
200def parse_etags(etag_str):

Callers 2

get_userMethod · 0.90
test_roundtripMethod · 0.90

Calls 1

encodeMethod · 0.45

Tested by 1

test_roundtripMethod · 0.72