1010logging .basicConfig (level = logging .INFO )
1111
1212# NOTE: TRACKING IS VERY ERRATIC ON THE TEST SERVERS. YOU MAY NEED TO USE
13- # PRODUCTION KEYS/PASSWORDS/ACCOUNT #.
13+ # PRODUCTION KEYS/PASSWORDS/ACCOUNT #. THE TEST SERVERS OFTEN RETURN A NOT FOUND ERROR.
14+ # WHEN TESTING IN PRODUCTION, GIVE SOME TIME FOR THE TRACKING TO PROPAGATE.
15+
16+
1417# We're using the FedexConfig object from example_config.py in this dir.
15- track = FedexTrackRequest (CONFIG_OBJ )
16- track .TrackPackageIdentifier .Type = 'TRACKING_NUMBER_OR_DOORTAG'
17- track .TrackPackageIdentifier .Value = '798114182456'
18+ customer_transaction_id = "*** TrackService Request v10 using Python ***" # Optional transaction_id
19+ track = FedexTrackRequest (CONFIG_OBJ , customer_transaction_id = customer_transaction_id )
20+
21+ # Track by Tracking Number
22+ track .SelectionDetails .PackageIdentifier .Type = 'TRACKING_NUMBER_OR_DOORTAG'
23+ track .SelectionDetails .PackageIdentifier .Value = '781820562774'
24+
25+ # FedEx operating company or delete
26+ del track .SelectionDetails .OperatingCompany
27+
28+ # Can optionally set the TrackingNumberUniqueIdentifier
29+ # del track.SelectionDetails.TrackingNumberUniqueIdentifier
30+
31+ # If you'd like to see some documentation on the ship service WSDL, un-comment
32+ # this line. (Spammy).
33+ #print track.client
34+
35+ # Un-comment this to see your complete, ready-to-send request as it stands
36+ # before it is actually sent. This is useful for seeing what values you can
37+ # change.
38+ #print track.SelectionDetails
39+ #print track.ClientDetail
40+ #print track.TransactionDetail
41+
1842
1943# Fires off the request, sets the 'response' attribute on the object.
2044track .send_request ()
2145
2246# See the response printed out.
2347print track .response
48+ #print rate_request.client.last_received()
49+
50+ # See the request printed out.
51+ #print track.client.last_sent()
2452
2553# Look through the matches (there should only be one for a tracking number
2654# query), and show a few details about each shipment.
2755print "== Results =="
28- for match in track .response .TrackDetails :
56+ #print track.response
57+ for match in track .response .CompletedTrackDetails [0 ].TrackDetails :
2958 print "Tracking #:" , match .TrackingNumber
30- print "Status:" , match .StatusDescription
59+ print "Tracking # UniqueID:" , match .TrackingNumberUniqueIdentifier
60+ print "Status:" , match .StatusDetail .Description
61+ print "Status AncillaryDetails Reason:" , match .StatusDetail .AncillaryDetails [- 1 ].Reason
62+ print "Status AncillaryDetails Description:" , match .StatusDetail .AncillaryDetails [- 1 ].ReasonDescription
63+ print "Commit Message:" , match .ServiceCommitMessage
0 commit comments