Skip to main content

Library integrating with the UPS API

Project description

ClassicUPS: A Useful UPS Library
================================

ClassicUPS is an Apache2 Licensed wrapper around the UPS API for creating
shipping labels and fetching a package's tracking status. This library by no
means encompasses all of the UPS functionality, but it is suitable for some of
the most common shipping-related common tasks.


Features
--------

- Given a tracking number, check its transit history, delivery status, and
delivery date

- Create shipping labels in GIF, PDF, HTML, or EPS (thermal printer) format


Installation
------------

Installation is easy:

$ pip install ClassicUPS


Quickstart
----------

from ClassicUPS.ups import UPSConnection

# Obtain credentials 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


# Check the delivery date of a package. Returns `None` if it has not been delivered
print ups.tracking_info('1Z12345E0291980793').delivered


# Create shipment and save shipping label as GIF file
from_addr = {
'name': 'Google',
'address1': '1600 Amphitheatre Parkway',
'city': 'Mountain View',
'state': 'CA',
'country': 'US',
'postal_code': '94043',
'phone': '6502530000'
}
to_addr = {
'name': 'President',
'address1': '1600 Pennsylvania Ave',
'city': 'Washington',
'state': 'DC',
'country': 'US',
'postal_code': '20500',
'phone': '202456-1111'
}
dimensions = { # in inches
'length': 1,
'width': 4,
'height': 9
}
weight = 10 # in lbs

# Create the shipment. Use file_format='EPS' for a thermal-printer-compatible EPS
shipment = ups.create_shipment(from_addr, to_addr, dimensions, weight, file_format='GIF')

# Print information about our shipment
print shipment.cost
print shipment.tracking_number

# Save the shipping label to print, email, etc
shipment.save_label(open('label.gif', 'wb'))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ClassicUPS-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

ClassicUPS-0.1.0.linux-x86_64.exe (65.2 kB view details)

Uploaded Source

File details

Details for the file ClassicUPS-0.1.0.tar.gz.

File metadata

  • Download URL: ClassicUPS-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ClassicUPS-0.1.0.tar.gz
Algorithm Hash digest
SHA256 583f20d6a2f22f40caeb01aa63d88e3f16a83cdf598c2e7289e6c72383e1b2a9
MD5 39f7feeb0ea726c9bfbbb17ea4b92640
BLAKE2b-256 ec93204a8c2b35763ed46cb74f79bbb227f554d8c923d410236da94c308d8abe

See more details on using hashes here.

File details

Details for the file ClassicUPS-0.1.0.linux-x86_64.exe.

File metadata

File hashes

Hashes for ClassicUPS-0.1.0.linux-x86_64.exe
Algorithm Hash digest
SHA256 60b08d48c76a4a7659ae37045ad78018735cc80551cd912999edb71da81ebdc8
MD5 a0b6b0232122f3d2867215ee42d0f71a
BLAKE2b-256 bdee4bcbec953b6d18fcb238509dc5d9d6cb77c1404eb51bed6e07eabe90bb46

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page