MCPcopy
hub / github.com/encode/httpx / __init__

Method __init__

httpx/_multipart.py:75–88  ·  view source on GitHub ↗
(self, name: str, value: str | bytes | int | float | None)

Source from the content-addressed store, hash-verified

73 """
74
75 def __init__(self, name: str, value: str | bytes | int | float | None) -> None:
76 if not isinstance(name, str):
77 raise TypeError(
78 f"Invalid type for name. Expected str, got {type(name)}: {name!r}"
79 )
80 if value is not None and not isinstance(value, (str, bytes, int, float)):
81 raise TypeError(
82 "Invalid type for value. Expected primitive type,"
83 f" got {type(value)}: {value!r}"
84 )
85 self.name = name
86 self.value: str | bytes = (
87 value if isinstance(value, bytes) else primitive_value_to_str(value)
88 )
89
90 def render_headers(self) -> bytes:
91 if not hasattr(self, "_headers"):

Callers

nothing calls this directly

Calls 1

primitive_value_to_strFunction · 0.85

Tested by

no test coverage detected