rates = pr.rates.get(
from_address={
"name": "Warehouse",
"street1": "417 Montgomery St",
"city": "San Francisco",
"state": "CA",
"zip": "94105",
"country": "US"
},
to_address={
"name": "Customer",
"street1": "123 Main St",
"city": "Austin",
"state": "TX",
"zip": "78701",
"country": "US"
},
parcel={"weight_oz": 16, "length": 9, "width": 6, "height": 2}
)
# Sorted cheapest first
cheapest = rates.rates[0]
print(f"{cheapest.carrier} {cheapest.service}: ${cheapest.rate_cents / 100}")
# USPS Ground Advantage: $5.42