MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / _encode_secret

Function _encode_secret

tests/lib/environments/test_worker.py:52–55  ·  view source on GitHub ↗

Build a work-item `secret` the way the control plane does: URL-safe base64 of a JSON payload, without padding.

(payload: dict[str, Any])

Source from the content-addressed store, hash-verified

50
51
52def _encode_secret(payload: dict[str, Any]) -> str:
53 """Build a work-item `secret` the way the control plane does: URL-safe
54 base64 of a JSON payload, without padding."""
55 return base64.urlsafe_b64encode(json.dumps(payload).encode()).decode().rstrip("=")
56
57
58def _api_status_error(code: int, body: object = None) -> APIStatusError:

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected