MCPcopy Create free account
hub / github.com/Unstructured-IO/unstructured-api / call_api

Function call_api

test_general/api/test_gzip.py:112–136  ·  view source on GitHub ↗
(
    client: TestClient,
    filenames_gzipped: List[str],
    filenames_verbatim: List[str],
    content_type: str,
    options: dict,
    samples_dir: str = "sample-docs",
)

Source from the content-addressed store, hash-verified

110
111
112def call_api(
113 client: TestClient,
114 filenames_gzipped: List[str],
115 filenames_verbatim: List[str],
116 content_type: str,
117 options: dict,
118 samples_dir: str = "sample-docs",
119) -> httpx.Response:
120 files = []
121 for filename in filenames_gzipped:
122 full_path = Path(samples_dir) / filename
123 files.append(("files", (str(full_path), open(full_path, "rb"), "application/gzip")))
124
125 for filename in filenames_verbatim:
126 full_path = Path(samples_dir) / filename
127 files.append(("files", (str(full_path), open(full_path, "rb"), content_type)))
128
129 response = client.post(
130 MAIN_API_ROUTE,
131 files=files,
132 data=options,
133 )
134 assert response.status_code == 200, response.text
135 assert len(response.text) > 0
136 return response
137
138
139def get_gzipped_response(

Calls

no outgoing calls

Tested by

no test coverage detected