MCPcopy Create free account
hub / github.com/PaddlePaddle/PaddleOCR / submit_url

Method submit_url

paddleocr/_api_client/_http.py:96–124  ·  view source on GitHub ↗
(
        self,
        model: str,
        file_url: str,
        optional_payload: dict,
        page_ranges: Optional[str] = None,
        batch_id: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

94 return self._timeout
95
96 def submit_url(
97 self,
98 model: str,
99 file_url: str,
100 optional_payload: dict,
101 page_ranges: Optional[str] = None,
102 batch_id: Optional[str] = None,
103 ) -> str:
104 body = {
105 "fileUrl": file_url,
106 "model": model,
107 "optionalPayload": optional_payload,
108 }
109 if page_ranges is not None:
110 body["pageRanges"] = page_ranges
111 if batch_id is not None:
112 body["batchId"] = batch_id
113 try:
114 resp = self._session.post(
115 self._jobs_url,
116 json=body,
117 timeout=self._timeout,
118 )
119 except requests.Timeout as e:
120 raise RequestTimeoutError(f"Request timed out: {e}") from e
121 except requests.ConnectionError as e:
122 raise NetworkError(f"Connection failed: {e}") from e
123 _raise_for_response(resp)
124 return _job_id_from_response(resp)
125
126 def submit_file(
127 self,

Callers 12

test_error_mapping_401Function · 0.95
test_error_mapping_400Function · 0.95
test_error_mapping_429Function · 0.95
test_error_mapping_503Function · 0.95
test_error_mapping_500Function · 0.95
_submitMethod · 0.45
_submitMethod · 0.45

Calls 5

_raise_for_responseFunction · 0.85
_job_id_from_responseFunction · 0.85
RequestTimeoutErrorClass · 0.70
NetworkErrorClass · 0.70
postMethod · 0.45