carrier: dhl: Check if status is 401 (API key is likely incorrect)
1 files changed, 4 insertions(+), 0 deletions(-) M shipments/carrier.py
M shipments/carrier.py => shipments/carrier.py +4 -0
@@ 404,6 404,10 @@ class DHL(Carrier): } response = requests.get(url, params=payload, headers=headers) payload = response.json() if payload.get('status') and payload['status'] == 401: raise ValueError("Unautorized for the given DHL endpoint. Is the APIkey correct?") result = PackageInfo(code, 'DHL') result.carrier_name = self.DISPLAYNAME result.status_category = StatusCategory.ERROR