Closed JosephSBoyle closed 3 years ago
The Exceptions.ConnectionError
contains the response, you can always access it if you need to.
Something like this should work:
try:
mkm.stock_management.get_stock()
except exceptions.ConnectionError as ex:
print(ex.response.status_code)
Is this what you're trying to achieve or am I misunderstanding something?
Hi, thanks for the response - what you're suggesting should work perfectly for me.
Best, Joe
Glad to help, am closing this issue if the solution works for you. Feel free to repoen it if necessary.
I'm writing an app which needs direct access to the API error text. Currently mkmsdk raises a
Exceptions.ConnectionError
. Ideally I'd just access theresponse
object directly even in the case of an error - I think this functionality could be useful for others who would like to store / manage error messages programmatically.Would you accept a pull request that added the option to directly access api response when an error occurs messages?