averbis / averbis-python-api

Conveniently access the REST API of Averbis products using Python
Apache License 2.0
12 stars 4 forks source link

When the server does not return JSON, a more sensible error message should be generated #57

Closed reckart closed 3 years ago

reckart commented 3 years ago

Is your feature request related to a problem? Please describe. When I create the client with the wrong URL, there can be cryptic error messages like:

__request(self, method, endpoint, **kwargs)
    520         raw_response = self._run_request(method, endpoint, **kwargs)
    521 
--> 522         response = raw_response.json()
    523         self.__handle_error(response)
    524         return response

These indicate that the server responds but does not provide JSON.

Describe the solution you'd like When the server does not return JSON, a more sensible error message should be generated

Additional context Was part of https://github.com/averbis/averbis-python-api/issues/53

DavidHuebner commented 3 years ago

Should be treated in #60 .