Home > Net >  ClassicUPS3 NameError: name 'unicode' is not defined
ClassicUPS3 NameError: name 'unicode' is not defined

Time:11-09

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)

CodePudding user response:

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.

  • Related