poundifdef / classicups Goto Github PK
View Code? Open in Web Editor NEWWrapper around the UPS API for creating shipping labels and fetching a package's tracking status.
License: Other
Wrapper around the UPS API for creating shipping labels and fetching a package's tracking status.
License: Other
{'Response': {'TransactionReference': {'XpciVersion': '1.0001'}, 'ResponseStatusDescription': 'Failure', 'ResponseStatusCode': '0', 'Error': {'ErrorSeverity': 'Hard', 'ErrorCode': '10002', 'ErrorDescription': 'The XML document is well formed but the document is not valid'}}}
Hi -
Since UPS servers supports only TLS 1.2 version can you please update your code to support it for TLS 1.2. Currently i'm using python 2.7.10 and the code by default it is using TLS 1.1 which is causing issues.
It would be great to have this package covered with tests.
Does ClassicUPS give the ability to retrieve time in transit?
If not, does anyone know a library that will?
Are there plans to add it to ClassicUPS?
Hi Jay,
I have been using this code for many years and I wanted to thank you for publishing it. UPS is switching to OAuth 2.0 and I was wondering if you could update the code so that it could be used going forward? Please let me know if this is something you would be able to do.
Thank you for your time,
Stephen
It would be great if I could get service name by its code with something like this:
def get_service_name(service_code):
"""
Given a service code, return the human-readable name for
that service
@return: string on success or False
"""
return SHIPPING_SERVICES_NAMES.get(service_code, service_code)
I'm using your package to check if packages have been delivered. The tracking codes I get are manually entered and sometimes they are entered with errors.
What's the right way to check if a tracking code is valid?
I hate to be that guy, but pep 8 wants packages to be all lower case
Modules should have short, all-lowercase names. Underscores can be used in the module
name if it improves readability. Python packages should also have short, all-lowercase
names,although the use of underscores is discouraged.
http://legacy.python.org/dev/peps/pep-0008/#package-and-module-names
But more important than that, thanks so much for writing and pushing up this code! I needed it and you really helped me out.
Matt
About 80% of the time I receive the error:
Traceback (most recent call last):
File "/Users/F/Desktop/delete.py", line 22, in <module>
tracking = ups.tracking_info('1Z51062E6893884735')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ClassicUPS/ups.py", line 71, in tracking_info
return TrackingInfo(self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ClassicUPS/ups.py", line 108, in __init__
self.result = ups_conn._transmit_request('track', tracking_request)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ClassicUPS/ups.py", line 65, in _transmit_request
resp = urllib.urlopen(url, xml.encode('ascii', 'xmlcharrefreplace'))\
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 89, in urlopen
return opener.open(url, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 215, in open
return getattr(self, name)(url, data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 443, in open_https
h.endheaders(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 882, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 844, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1263, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 363, in wrap_socket
_context=self)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 611, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 840, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] EOF occurred in violation of protocol (_ssl.c:661)
Do you know how to fix this? Thanks!
>>> t = ups.tracking_info('1Z12345E0205271688 ')
>>> t.in_transit
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/ClassicUPS/ups.py", line 131, in in_transit
in_transit = [x for x in self.shipment_activities
File "/usr/local/lib/python2.7/dist-packages/ClassicUPS/ups.py", line 116, in shipment_activities
['Shipment']['Package']['Activity'])
KeyError: 'Shipment'
Should handle if no shipment data is returned in the XML
The dependencies are pinned to a years-old version.
Hello,
Today, after many years of working, this library is giving me an error. Can someone please help?
tracking = ups.tracking_info(tracking_number) throws the following exception:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)
Thank you very much
The last commit in this repo was several years ago and work has been done in other repositories.
Please think about handing over this package to one of the people who developed this further.
Please see the error message below:
ERROR: classicups 0.1.8 has requirement xmltodict==0.4.2, but you'll have xm
ltodict 0.12.0 which is incompatible.
Installing collected packages: xmltodict
Successfully installed xmltodict-0.12.0
This is my first attempt at importing a library from GitHub and actually my first program in Python, so I apologize if I am overlooking something very simple. Any advice would be appreciated.
I am using python-3.7.3-amd64 and the latest version of PyCharm.
I believe I did the steps correctly when I imported ClassicUPS into PyCharm by creating a project -> File -> Settings -> (project name) -> Project Interpreter -> (+ symbol) -> Search for ClassicUPS -> Install.
When I attempt to run the first segment of code, I get the following error:
Cannot find reference 'UPS Connection' in init.py
Code segment:
from ClassicUPS import UPSConnection
# Credentials obtained from the UPS website
ups = UPSConnection(license_number,
user_id,
password,
shipper_number, # Optional if you are not creating a shipment
debug=True) # Use the UPS sandbox API rather than prod
I added the following module under class TrackingInfo(object): but I get the error below when trying to execute print(tracking.shipment)
I am trying to return the shipment information from the api call and ClassicUPS only gives the ability to see the activity scans.
``
@Property
def shipment(self):
shipment = (self.result.dict_response['TrackResponse']
['Shipment'])
if type(shipment) != list:
shipment = [shipment]
return shipment
Error:
Traceback (most recent call last): File "C:/xxxxx.py", line 20, in <module> print(tracking.shipment) AttributeError: 'TrackingInfo' object has no attribute 'shipment'
Any advice would be much appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.