Skip to content

Commit d01e536

Browse files
authoredFeb 20, 2020
Merge pull request #131 from koushikmln/master
Fixed Track Shipment Example Comments
2 parents 63271d9 + 53533b3 commit d01e536

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
 

‎examples/create_shipment.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,12 @@
8888
# See documentation for paper types, there quite a few.
8989
shipment.RequestedShipment.LabelSpecification.LabelStockType = 'PAPER_7X4.75'
9090

91-
# This indicates if the top or bottom of the label comes out of the
92-
# printer first.
93-
# BOTTOM_EDGE_OF_TEXT_FIRST or TOP_EDGE_OF_TEXT_FIRST
9491
# Timestamp in YYYY-MM-DDThh:mm:ss format, e.g. 2002-05-30T09:00:00
9592
shipment.RequestedShipment.ShipTimestamp = datetime.datetime.now().replace(microsecond=0).isoformat()
9693

97-
# BOTTOM_EDGE_OF_TEXT_FIRST, TOP_EDGE_OF_TEXT_FIRST
94+
# This indicates if the top or bottom of the label comes out of the
95+
# printer first.
96+
# BOTTOM_EDGE_OF_TEXT_FIRST or TOP_EDGE_OF_TEXT_FIRST
9897
shipment.RequestedShipment.LabelSpecification.LabelPrintingOrientation = 'TOP_EDGE_OF_TEXT_FIRST'
9998

10099
# Delete the flags we don't want.

‎examples/track_shipment.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
# This will dump the response data dict to json.
5959
# from fedex.tools.conversion import sobject_to_json
60-
# print(basic_sobject_to_dict(track.response))
60+
# print(sobject_to_json(track.response))
6161

6262
# Look through the matches (there should only be one for a tracking number
6363
# query), and show a few details about each shipment.
@@ -66,12 +66,13 @@
6666
print("Tracking #: {}".format(match.TrackingNumber))
6767
if hasattr(match, 'TrackingNumberUniqueIdentifier'):
6868
print("Tracking # UniqueID: {}".format(match.TrackingNumberUniqueIdentifier))
69-
if hasattr(match, 'StatusDetail.Description'):
70-
print("Status Description: {}".format(match.StatusDetail.Description))
71-
if hasattr(match, 'StatusDetail.AncillaryDetails'):
72-
print("Status AncillaryDetails Reason: {}".format(match.StatusDetail.AncillaryDetails[-1].Reason))
73-
print("Status AncillaryDetails Description: {}"
74-
"".format(match.StatusDetail.AncillaryDetails[-1].ReasonDescription))
69+
if hasattr(match, 'StatusDetail'):
70+
if hasattr(getattr(match, 'StatusDetail'), 'Description'):
71+
print("Status Description: {}".format(match.StatusDetail.Description))
72+
if hasattr(getattr(match, 'StatusDetail'), 'AncillaryDetails'):
73+
print("Status AncillaryDetails Reason: {}".format(match.StatusDetail.AncillaryDetails[-1].Reason))
74+
print("Status AncillaryDetails Description: {}"
75+
"".format(match.StatusDetail.AncillaryDetails[-1].ReasonDescription))
7576
if hasattr(match, 'ServiceCommitMessage'):
7677
print("Commit Message: {}".format(match.ServiceCommitMessage))
7778
if hasattr(match, 'Notification'):

0 commit comments

Comments
 (0)
Please sign in to comment.