Usable UPS Integration in Python
Project description
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
Track delivery status of tracking number
Create prepaid shipping labels in GIF or EPL (thermal printer) format
Installation
Installation is easy:
$ pip install ClassicUPS
Quickstart
Create a UPSConnection object, which gives you access to common UPS methods:
from ClassicUPS.ups 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
Check the delivery date of a package.
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': '2024561111'
}
dimensions = { # in inches
'length': 1,
'width': 4,
'height': 9
}
weight = 10 # in lbs
# Create the shipment. Use file_format='EPL' for a thermal-printer-compatible EPL
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ClassicUPS-0.1.2.tar.gz
.
File metadata
- Download URL: ClassicUPS-0.1.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93fde4256fd12cc3dfae929e6d36c31a0feaf0aa6f272e2f49e525d67557ed8f |
|
MD5 | de3d4e168f66664b6debdb59bc425a80 |
|
BLAKE2b-256 | 006422e839101eadbbbaa5ed261d24a0c7fdf4e7989a4aa5a66cb3678b16b4c6 |
File details
Details for the file ClassicUPS-0.1.2.linux-x86_64.exe
.
File metadata
- Download URL: ClassicUPS-0.1.2.linux-x86_64.exe
- Upload date:
- Size: 69.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9f320c338a18849a038dff1d93b2f3d040f52d79c508964a65e0e8e4109e61c |
|
MD5 | 1e5e13e3995f9324d1cd1c8d1118f9d2 |
|
BLAKE2b-256 | e520497586af772c52a2854a2e68442b24162472a6d7b929e7ac6e8db5b1ab35 |