From 7bb0c04ca170f39c52d49aa13dfd5868a9d9f43f Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Fri, 11 Mar 2022 08:58:07 -0800 Subject: [PATCH] [IMP] stock_delivery_planner: method to collect carriers to make it easier to provide or filter --- delivery_ups_hibou/models/ups_request_patch.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/delivery_ups_hibou/models/ups_request_patch.py b/delivery_ups_hibou/models/ups_request_patch.py index 5c44b90e..5df1b5d7 100644 --- a/delivery_ups_hibou/models/ups_request_patch.py +++ b/delivery_ups_hibou/models/ups_request_patch.py @@ -165,13 +165,12 @@ def patched_get_shipping_price(self, shipment_info, packages, shipper, ship_from _logger.warning('exception during the UPS Time In Transit request. ' + str(e)) tnt_ready = False tnt_response = '-1' - if tnt_ready: + if tnt_ready and hasattr(tnt_response, 'TransitResponse') and hasattr(tnt_response.TransitResponse, 'ServiceSummary'): for service in tnt_response.TransitResponse.ServiceSummary: - if TNT_CODE_MAP.get(service.Service.Code) == service_type: + if TNT_CODE_MAP.get(service.Service.Code) == res['service_code']: if hasattr(service, 'EstimatedArrival') and hasattr(service.EstimatedArrival, 'BusinessDaysInTransit'): res['transit_days'] = int(service.EstimatedArrival.BusinessDaysInTransit) break - # use TNT API to result.append(res) else: result = {}