MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / _make_multipart_request

Method _make_multipart_request

lib/cli/src/crewai_cli/plus_api.py:131–165  ·  view source on GitHub ↗

Send an authenticated multipart request containing a project ZIP.

(
        self,
        method: HttpMethod,
        endpoint: str,
        *,
        zip_file_path: str | Path,
        data: dict[str, str] | None = None,
        timeout: float | None = None,
        verify: bool = True,
    )

Source from the content-addressed store, hash-verified

129 )
130
131 def _make_multipart_request(
132 self,
133 method: HttpMethod,
134 endpoint: str,
135 *,
136 zip_file_path: str | Path,
137 data: dict[str, str] | None = None,
138 timeout: float | None = None,
139 verify: bool = True,
140 ) -> httpx.Response:
141 """Send an authenticated multipart request containing a project ZIP."""
142 url = urljoin(self.base_url, endpoint)
143 headers = dict(cast(dict[str, str], self.headers))
144 headers.pop("Content-Type", None)
145 path = Path(zip_file_path)
146 request_kwargs: dict[str, Any] = {"headers": headers}
147 if data is not None:
148 request_kwargs["data"] = data
149 if timeout is not None:
150 request_kwargs["timeout"] = timeout
151 # An older crewai-core has no _http_client; its clients ignore proxies.
152 http_client = getattr(self, "_http_client", None)
153
154 with (
155 path.open("rb") as file_handle,
156 (
157 http_client(verify)
158 if http_client
159 else httpx.Client(verify=verify, trust_env=False)
160 ) as client,
161 ):
162 files = {
163 "zip_file": (path.name, file_handle, "application/zip"),
164 }
165 return client.request(method, url, files=files, **request_kwargs)
166
167 def create_crew_from_zip(
168 self,

Callers 2

create_crew_from_zipMethod · 0.95
update_crew_from_zipMethod · 0.95

Calls 3

popMethod · 0.80
openMethod · 0.80
requestMethod · 0.45

Tested by

no test coverage detected