I am using Python wrapper to your API published here https://github.com/abbyysdk/ocrsdk.com/tree/master/Python but I cannot put there this parameter xml:writeFormatting
Can you advise me what to do?
result = ocr_engine.process_and_download(file, exportFormat='xml', language='English', writeFormatting = 'true')
print(result["xml"].read())
Or
result = ocr_engine.process_and_download(file, exportFormat='xml', language='English', xmlwriteFormatting = 'true')
print(result["xml"].read())
Does not work… I do not know what is the name of the parameter… should it be really in URL like "http://cloud.ocrsdk.com/processImage?language=english&exportFormat=xml,xml:writeformatting=true
In that case I probably need to change the code provided by you because I guess I cannot pass xml:writeformatting via **kwargs
def process_and_download(self, file, timeout=300, **kwargs):
if 'exportFormat' in list(kwargs.keys()):
formats = kwargs['exportFormat']
else:
formats = DEFAULT_EXPORT_FORMAT
formats = formats.split(',')
task = self.processImage(file=file, **kwargs)
result = self.wait_for_task(task, timeout=timeout)
urls_keys = [key for key in list(result.keys()) if key.startswith('resultUrl')]
urls = list(zip(formats, list(map(result.__getitem__, urls_keys))))
streams = dict()
for format, url in urls:
result = self.session.get(url)
streams[format] = BytesIO(result.content)
return streams
コメント
1件のコメント
This parameter should be specified in the URL and divided from another parameters by "&", i.e. : http://cloud.ocrsdk.com/processImage?language=english&exportFormat=xml&xml:writeFormatting=true
Yes, you need to modify the sample code for your needs, because this parameter is not implemented in this standard sample. The current Python sample is the simplest example of how Cloud OCR SDK should be used. It just gives a general idea of how to do that in Python.
サインインしてコメントを残してください。