|
25 | 25 |
|
26 | 26 | # See page 355 in WS_ShipService.pdf for a full list. Here are the common ones: |
27 | 27 | # STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, FEDEX_EXPRESS_SAVER |
| 28 | +# To receive rates for multiple ServiceTypes set to None. |
28 | 29 | rate_request.RequestedShipment.ServiceType = 'FEDEX_GROUND' |
29 | 30 |
|
30 | 31 | # What kind of package this will be shipped in. |
|
88 | 89 | # Here is the overall end result of the query. |
89 | 90 | print "HighestSeverity:", rate_request.response.HighestSeverity |
90 | 91 |
|
91 | | -for detail in rate_request.response.RateReplyDetails[0].RatedShipmentDetails: |
92 | | - for surcharge in detail.ShipmentRateDetail.Surcharges: |
93 | | - if surcharge.SurchargeType == 'OUT_OF_DELIVERY_AREA': |
94 | | - print "ODA rate_request charge %s" % surcharge.Amount.Amount |
| 92 | +# RateReplyDetails can contain rates for multiple ServiceTypes if ServiceType was set to None |
| 93 | +for service in rate_request.response.RateReplyDetails: |
| 94 | + for detail in service.RatedShipmentDetails: |
| 95 | + for surcharge in detail.ShipmentRateDetail.Surcharges: |
| 96 | + if surcharge.SurchargeType == 'OUT_OF_DELIVERY_AREA': |
| 97 | + print "%s: ODA rate_request charge %s" % (service.ServiceType, surcharge.Amount.Amount) |
95 | 98 |
|
96 | | -for rate_detail in rate_request.response.RateReplyDetails[0].RatedShipmentDetails: |
97 | | - print "Net FedEx Charge %s %s" % (rate_detail.ShipmentRateDetail.TotalNetFedExCharge.Currency, |
98 | | - rate_detail.ShipmentRateDetail.TotalNetFedExCharge.Amount) |
| 99 | + for rate_detail in service.RatedShipmentDetails: |
| 100 | + print "%s: Net FedEx Charge %s %s" % (service.ServiceType, rate_detail.ShipmentRateDetail.TotalNetFedExCharge.Currency, |
| 101 | + rate_detail.ShipmentRateDetail.TotalNetFedExCharge.Amount) |
99 | 102 |
|
0 commit comments