11from typing import Any , Dict , List , Optional , Union , cast , overload
2+ from wsgiref import headers
23
34from typing_extensions import Literal , NotRequired , TypedDict
45
@@ -159,10 +160,10 @@ class OCRResponse(BaseResponse):
159160 tags : List [str ]
160161 has_text : bool
161162 sections : List [object ]
162- total_pages : Optional [int ] # Only available for PDFs
163- page_ranges : Optional [
163+ total_pages : Optional [int ]
164+ page_range : Optional [
164165 List [int ]
165- ] # Only available if page_ranges is set in the request parameters.
166+ ] # Only available if page_range is set in the request parameters.
166167
167168
168169class Vision (ClientConfig ):
@@ -204,15 +205,13 @@ def vocr(
204205 ).perform_with_content ()
205206 return resp
206207
207- content_type = options .get ("content_type" , "application/octet-stream" )
208- headers = {"Content-Type" : content_type }
209-
208+ files = {"file" : blob }
210209 resp = Request (
211210 config = self .config ,
212211 path = path ,
213212 params = options ,
214213 data = blob ,
215- headers = headers ,
214+ files = files ,
216215 verb = "post" ,
217216 ).perform_with_content ()
218217 return resp
@@ -239,16 +238,13 @@ def object_detection(
239238 verb = "post" ,
240239 ).perform_with_content ()
241240 return resp
242-
243- content_type = options .get ("content_type" , "application/octet-stream" )
244- headers = {"Content-Type" : content_type }
245-
241+ files = {"file" : blob }
246242 resp = Request (
247243 config = self .config ,
248244 path = path ,
249245 params = options ,
250246 data = blob ,
251- headers = headers ,
247+ files = files ,
252248 verb = "post" ,
253249 ).perform_with_content ()
254250 return resp
@@ -291,15 +287,13 @@ async def vocr(
291287 ).perform_with_content ()
292288 return resp
293289
294- content_type = options .get ("content_type" , "application/octet-stream" )
295- headers = {"Content-Type" : content_type }
296-
290+ files = {"file" : blob }
297291 resp = await AsyncRequest (
298292 config = self .config ,
299293 path = path ,
300294 params = options ,
301295 data = blob ,
302- headers = headers ,
296+ files = files ,
303297 verb = "post" ,
304298 ).perform_with_content ()
305299 return resp
@@ -329,15 +323,13 @@ async def object_detection(
329323 ).perform_with_content ()
330324 return resp
331325
332- content_type = options .get ("content_type" , "application/octet-stream" )
333- headers = {"Content-Type" : content_type }
334-
326+ files = {"file" : blob }
335327 resp = await AsyncRequest (
336328 config = self .config ,
337329 path = path ,
338330 params = options ,
339331 data = blob ,
340- headers = headers ,
332+ files = files ,
341333 verb = "post" ,
342334 ).perform_with_content ()
343335 return resp
0 commit comments