GithubHelp home page GithubHelp logo

poundifdef / classicups Goto Github PK

View Code? Open in Web Editor NEW
58.0 58.0 36.0 28 KB

Wrapper around the UPS API for creating shipping labels and fetching a package's tracking status.

License: Other

Python 100.00%

classicups's People

Contributors

poundifdef avatar rckclmbr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

classicups's Issues

SSL: CERTIFICATE_VERIFY_FAILED

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

TLS 1.2 support

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.

Tests for UPS

It would be great to have this package covered with tests.

Module to return Shipment Information vs Activity Information

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.

Regularly receive error: "IOError: [Errno socket error] EOF occurred in violation of protocol (_ssl.c:661)"

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!

xmltodict error

Please see the error message below:

pip install xmltodict

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

Need a good way to detect invalid tracking codes

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?

ClassicUPS ain't a pep8 name

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

Time in transit

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?

ERROR CODE

{'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'}}}

Cannot find reference 'UPS Connection' in __init__.py

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

image

Get shipping service name by its code

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)

KeyError: Shipment

>>> 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.