Skip to content

Fixed Track Shipment Example Comments #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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