Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sd2 925 eagledoc jsondecodeerror #285

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion edenai_apis/apis/base64/base64_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def ocr__data_extraction(
except ValueError:
bbox = BoundingBox.unknown()

if key := value.get(key):
if key := value.get("key"):
items.append(
ItemDataExtraction(
key=key,
Expand Down
22 changes: 10 additions & 12 deletions edenai_apis/apis/eagledoc/eagledoc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

import requests

from edenai_apis.apis.eagledoc.eagledoc_ocr_normalizer import (
eagledoc_financial_parser,
eagledoc_invoice_parser,
eagledoc_receipt_parser,
)
from edenai_apis.features import OcrInterface, ProviderInterface
from edenai_apis.features.ocr.financial_parser.financial_parser_dataclass import (
FinancialParserDataClass,
)
from edenai_apis.features.ocr.invoice_parser import InvoiceParserDataClass
from edenai_apis.features.ocr.receipt_parser import ReceiptParserDataClass
from edenai_apis.loaders.loaders import ProviderDataEnum, load_provider
from edenai_apis.utils.exception import ProviderException
from edenai_apis.utils.types import ResponseType
from edenai_apis.features.ocr.financial_parser.financial_parser_dataclass import (
FinancialParserDataClass,
)
from edenai_apis.apis.eagledoc.eagledoc_ocr_normalizer import (
eagledoc_invoice_parser,
eagledoc_receipt_parser,
eagledoc_financial_parser,
)


class EagledocApi(ProviderInterface, OcrInterface):
Expand Down Expand Up @@ -50,10 +50,8 @@ def _make_post_request(self, file: BufferedReader, endpoint: str = ""):

try:
original_response = response.json()
except JSONDecodeError:
raise ProviderException(
message="Internal Server Error", code=500
) from JSONDecodeError
except JSONDecodeError as exc:
raise ProviderException(message="Internal Server Error", code=500) from exc

if response.status_code != 200:
raise ProviderException(message=response.json(), code=response.status_code)
Expand Down
Loading