Skip to content

Commit 6a43a71

Browse files
committed
update example doc, update error handling
1 parent 1b94b75 commit 6a43a71

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

examples/README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ python-fedex Examples
22
=====================
33
This directory contains a number of examples of how to use python-fedex. For
44
these examples to work, you must open example_config.py and enter your
5-
testing account credentials there.
5+
testing account credentials there.

examples/country_postal_inquiry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
inquiry.Address.City = 'Clemson'
2020
inquiry.Address.StateOrProvinceCode = 'SC'
2121

22-
# If you'd like to see some documentation on the ship service WSDL, un-comment
22+
# If you'd like to see some documentation on the country service WSDL, un-comment
2323
# this line. (Spammy).
2424
# print(inquiry.client)
2525

examples/create_freight_shipment.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
"""
3-
This example shows how to create shipments. The variables populated below
3+
This example shows how to create a freight shipment and generate
4+
a waybill as output. The variables populated below
45
represents the minimum required values. You will need to fill all of these, or
56
risk seeing a SchemaValidationError exception thrown.
67

examples/create_shipment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
"""
3-
This example shows how to create shipments. The variables populated below
3+
This example shows how to create a shipment and generate a waybill as output. The variables populated below
44
represents the minimum required values. You will need to fill all of these, or
55
risk seeing a SchemaValidationError exception thrown.
66

examples/track_shipment.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,19 @@
5353
print("== Results ==")
5454
for match in track.response.CompletedTrackDetails[0].TrackDetails:
5555
print("Tracking #: {}".format(match.TrackingNumber))
56-
print("Tracking # UniqueID: {}".format(match.TrackingNumberUniqueIdentifier))
57-
print("Status: {}".format(match.StatusDetail.Description))
58-
print("Status AncillaryDetails Reason: {}".format(match.StatusDetail.AncillaryDetails[-1].Reason))
59-
print("Status AncillaryDetails Description:{}".format(match.StatusDetail.AncillaryDetails[-1].ReasonDescription))
60-
print("Commit Message:{}".format(match.ServiceCommitMessage))
56+
if hasattr(match, 'TrackingNumberUniqueIdentifier'):
57+
print("Tracking # UniqueID: {}".format(match.TrackingNumberUniqueIdentifier))
58+
if hasattr(match, 'StatusDetail.Description'):
59+
print("Status Description: {}".format(match.StatusDetail.Description))
60+
if hasattr(match, 'StatusDetail.AncillaryDetails'):
61+
print("Status AncillaryDetails Reason: {}".format(match.StatusDetail.AncillaryDetails[-1].Reason))
62+
print("Status AncillaryDetails Description: {}".format(match.StatusDetail.AncillaryDetails[-1].ReasonDescription))
63+
if hasattr(match, 'ServiceCommitMessage'):
64+
print("Commit Message: {}".format(match.ServiceCommitMessage))
65+
if hasattr(match, 'Notification'):
66+
print("Notification Severity: {}".format(match.Notification.Severity))
67+
print("Notification Code: {}".format(match.Notification.Code))
68+
print("Notification Message: {}".format(match.Notification.Message))
6169
print("")
6270

6371
event_details = []

0 commit comments

Comments
 (0)