|
57 | 57 |
|
58 | 58 | # This will dump the response data dict to json.
|
59 | 59 | # from fedex.tools.conversion import sobject_to_json
|
60 |
| -# print(basic_sobject_to_dict(track.response)) |
| 60 | +# print(sobject_to_json(track.response)) |
61 | 61 |
|
62 | 62 | # Look through the matches (there should only be one for a tracking number
|
63 | 63 | # query), and show a few details about each shipment.
|
|
66 | 66 | print("Tracking #: {}".format(match.TrackingNumber))
|
67 | 67 | if hasattr(match, 'TrackingNumberUniqueIdentifier'):
|
68 | 68 | 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)) |
75 | 76 | if hasattr(match, 'ServiceCommitMessage'):
|
76 | 77 | print("Commit Message: {}".format(match.ServiceCommitMessage))
|
77 | 78 | if hasattr(match, 'Notification'):
|
|
0 commit comments