Skip to content

Commit 009cdb9

Browse files
author
Greg Taylor
committed
Merge pull request #25 from danielatdattrixdotcom/master
Add ability to request transit information with rate request
2 parents 4658c0c + 01ca994 commit 009cdb9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

examples/rate_request.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
# We're using the FedexConfig object from example_config.py in this dir.
2020
rate_request = FedexRateServiceRequest(CONFIG_OBJ)
2121

22+
# If you wish to have transit data returned with your request you
23+
# need to uncomment the following
24+
# rate_request.ReturnTransitAndCommit = True
25+
2226
# This is very generalized, top-level information.
2327
# REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER or STATION
2428
rate_request.RequestedShipment.DropoffType = 'REGULAR_PICKUP'

fedex/services/rate_service.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def _prepare_wsdl_objects(self):
4141
This is the data that will be used to create your shipment. Create
4242
the data structure and get it ready for the WSDL request.
4343
"""
44+
45+
# Default behavior is to not request transit information
46+
self.ReturnTransitAndCommit = False
47+
4448
# This is the primary data structure for processShipment requests.
4549
self.RequestedShipment = self.client.factory.create('RequestedShipment')
4650
self.RequestedShipment.ShipTimestamp = datetime.now()
@@ -107,7 +111,8 @@ def _assemble_and_send_request(self):
107111
ClientDetail=self.ClientDetail,
108112
TransactionDetail=self.TransactionDetail,
109113
Version=self.VersionId,
110-
RequestedShipment=self.RequestedShipment)
114+
RequestedShipment=self.RequestedShipment,
115+
ReturnTransitAndCommit=self.ReturnTransitAndCommit)
111116
return response
112117

113118
def add_package(self, package_item):
@@ -125,4 +130,4 @@ def add_package(self, package_item):
125130
package_weight = package_item.Weight.Value
126131
self.RequestedShipment.TotalWeight.Value += package_weight
127132
self.RequestedShipment.PackageCount += 1
128-
133+

0 commit comments

Comments
 (0)