MCPcopy Create free account
hub / github.com/requests-cache/requests-cache / decode

Function decode

requests_cache/_utils.py:28–34  ·  view source on GitHub ↗

Decode a value from bytes, if hasn't already been. Note: ``PreparedRequest.body`` is always encoded in utf-8.

(value, encoding='utf-8')

Source from the content-addressed store, hash-verified

26
27
28def decode(value, encoding='utf-8') -> str:
29 """Decode a value from bytes, if hasn't already been.
30 Note: ``PreparedRequest.body`` is always encoded in utf-8.
31 """
32 if not value:
33 return ''
34 return value.decode(encoding) if isinstance(value, bytes) else value
35
36
37def encode(value, encoding='utf-8') -> bytes:

Callers 6

normalize_headersFunction · 0.85
normalize_json_bodyFunction · 0.85
normalize_paramsFunction · 0.85
from_headersMethod · 0.85
keysMethod · 0.85
itemsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…