MCPcopy Create free account
hub / github.com/encode/httpx / format_certificate

Function format_certificate

httpx/_main.py:194–209  ·  view source on GitHub ↗
(cert: _PeerCertRetDictType)

Source from the content-addressed store, hash-verified

192
193
194def format_certificate(cert: _PeerCertRetDictType) -> str: # pragma: no cover
195 lines = []
196 for key, value in cert.items():
197 if isinstance(value, (list, tuple)):
198 lines.append(f"* {key}:")
199 for item in value:
200 if key in ("subject", "issuer"):
201 for sub_item in item:
202 lines.append(f"* {sub_item[0]}: {sub_item[1]!r}")
203 elif isinstance(item, tuple) and len(item) == 2:
204 lines.append(f"* {item[0]}: {item[1]!r}")
205 else:
206 lines.append(f"* {item!r}")
207 else:
208 lines.append(f"* {key}: {value!r}")
209 return "\n".join(lines)
210
211
212def trace(

Callers 1

traceFunction · 0.85

Calls 2

joinMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected