Skip to content

Commit

Permalink
Merge pull request #131 from koushikmln/master
Browse files Browse the repository at this point in the history
Fixed Track Shipment Example Comments
  • Loading branch information
radzhome authored Feb 20, 2020
2 parents 63271d9 + 53533b3 commit d01e536
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
7 changes: 3 additions & 4 deletions examples/create_shipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,12 @@
# See documentation for paper types, there quite a few.
shipment.RequestedShipment.LabelSpecification.LabelStockType = 'PAPER_7X4.75'

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

# BOTTOM_EDGE_OF_TEXT_FIRST, TOP_EDGE_OF_TEXT_FIRST
# This indicates if the top or bottom of the label comes out of the
# printer first.
# BOTTOM_EDGE_OF_TEXT_FIRST or TOP_EDGE_OF_TEXT_FIRST
shipment.RequestedShipment.LabelSpecification.LabelPrintingOrientation = 'TOP_EDGE_OF_TEXT_FIRST'

# Delete the flags we don't want.
Expand Down
15 changes: 8 additions & 7 deletions examples/track_shipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

# This will dump the response data dict to json.
# from fedex.tools.conversion import sobject_to_json
# print(basic_sobject_to_dict(track.response))
# print(sobject_to_json(track.response))

# Look through the matches (there should only be one for a tracking number
# query), and show a few details about each shipment.
Expand All @@ -66,12 +66,13 @@
print("Tracking #: {}".format(match.TrackingNumber))
if hasattr(match, 'TrackingNumberUniqueIdentifier'):
print("Tracking # UniqueID: {}".format(match.TrackingNumberUniqueIdentifier))
if hasattr(match, 'StatusDetail.Description'):
print("Status Description: {}".format(match.StatusDetail.Description))
if hasattr(match, 'StatusDetail.AncillaryDetails'):
print("Status AncillaryDetails Reason: {}".format(match.StatusDetail.AncillaryDetails[-1].Reason))
print("Status AncillaryDetails Description: {}"
"".format(match.StatusDetail.AncillaryDetails[-1].ReasonDescription))
if hasattr(match, 'StatusDetail'):
if hasattr(getattr(match, 'StatusDetail'), 'Description'):
print("Status Description: {}".format(match.StatusDetail.Description))
if hasattr(getattr(match, 'StatusDetail'), 'AncillaryDetails'):
print("Status AncillaryDetails Reason: {}".format(match.StatusDetail.AncillaryDetails[-1].Reason))
print("Status AncillaryDetails Description: {}"
"".format(match.StatusDetail.AncillaryDetails[-1].ReasonDescription))
if hasattr(match, 'ServiceCommitMessage'):
print("Commit Message: {}".format(match.ServiceCommitMessage))
if hasattr(match, 'Notification'):
Expand Down

0 comments on commit d01e536

Please sign in to comment.