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

Method form

tests/test_prepare.py:98–106  ·  view source on GitHub ↗

The multipart content that `body` is sent as next to a file.

(self, body: Mapping[str, object])

Source from the content-addressed store, hash-verified

96 return dict(self.request.url.params)
97
98 async def form(self, body: Mapping[str, object]) -> bytes:
99 """The multipart content that `body` is sent as next to a file."""
100 options = make_request_options(extra_headers={"Content-Type": "multipart/form-data; boundary=boundary"})
101 files = [("file", b"contents")]
102 if isinstance(self._client, Anthropic):
103 self._client.post("/foo", body=body, files=files, options=options, cast_to=httpx2.Response)
104 else:
105 await self._client.post("/foo", body=body, files=files, options=options, cast_to=httpx2.Response)
106 return self.request.content
107
108
109@pytest.fixture(params=[True, False], ids=["sync", "async"])

Calls 2

make_request_optionsFunction · 0.90
postMethod · 0.45

Tested by

no test coverage detected