kermitt2 / grobid_client_python

Python client for GROBID Web services
Apache License 2.0
275 stars 74 forks source link

Errors like 500 are not reported from the client #50

Closed lfoppiano closed 1 year ago

lfoppiano commented 1 year ago

I've noticed that only 408 response were reported. I had some response with error 500 which were not visible in the client response.

The line here: https://github.com/kermitt2/grobid_client_python/blob/master/grobid_client/grobid_client.py#L217 is considering reporting the error only when the body is None, however Grobid is returning a message in the body of the response in many cases.

We should check also the error code returned before.

E.g.,

            if status != 200 or text is None:
                print("Processing of", input_file, "failed with error", str(status), ",", text)
            else:

Let me know if this makes sense, and I'll submit a PR for this.