ClassicUPS3 NameError: name 'unicode' is not defined

Question:

I am trying to use the ClassicUPS3 library to have a UPS API tracker. When I run the code I am getting an error message saying, "NameError: name ‘unicode’ is not defined". I am not sure if it something to do with the UPS library or if it is something in the response that is throwing me this error.

from ClassicUPS3 import UPSConnection


# Credentials obtained from the UPS website
UPS = UPSConnection('API-KEY',
                'User',
                'Password',
                debug=True)      # Use the UPS sandbox API rather than prod




tracking = UPS.tracking_info('1ZXXXXXXXXXXX')


print(tracking.ship_status)
print(tracking.in_transit)
print(tracking.delivered)
Asked By: adean2121

||

Answers:

Looking at the source code here, it seems that ClassicalUPS3 relies on a specific format that must be extracted from an XML file, then converted to a dict, then processed.

I tried to run your example (with my own tracking number), and I also found out that the first member you refer to (ship_status) is not supported in the definition of TrackingInfo.

In short, it doesn’t look like ClassicalUPS3 is being maintained these days.

Answered By: JustLearning
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.