Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 386a836

Browse files
author
Matt Hwang
committed
Update examples to use estimated_days
1 parent 4b2082d commit 386a836

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/filter-by-delivery-time.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868

6969
# filter rates by max. transit time, then select cheapest
7070
eligible_rate = (
71-
rate for rate in rates if rate['days'] <= MAX_TRANSIT_TIME_DAYS)
71+
rate for rate in rates if rate['estimated_days'] <= MAX_TRANSIT_TIME_DAYS)
7272
rate = min(eligible_rate, key=lambda x: float(x['amount']))
7373
print("Picked service %s %s for %s %s with est. transit time of %s days" %
74-
(rate['provider'], rate['servicelevel']['name'], rate['currency'], rate['amount'], rate['days']))
74+
(rate['provider'], rate['servicelevel']['name'], rate['currency'], rate['amount'], rate['estimated_days']))
7575

7676
# Purchase the desired rate. asynchronous=False indicates that the function will wait until the
7777
# carrier returns a shipping label before it returns

examples/purchase-fastest-service.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@
6969

7070
# Find the fastest possible transite time
7171
eligible_rates = (
72-
rate for rate in rates if rate['days'] <= MAX_TRANSIT_TIME_DAYS)
72+
rate for rate in rates if rate['estimated_days'] <= MAX_TRANSIT_TIME_DAYS)
7373
rate = min(eligible_rates, key=lambda x: float(x['amount']))
7474
print("Picked service %s %s for %s %s with est. transit time of %s days" %
75-
(rate['provider'], rate['servicelevel']['name'], rate['currency'], rate['amount'], rate['days']))
75+
(rate['provider'], rate['servicelevel']['name'], rate['currency'], rate['amount'], rate['estimated_days']))
7676

7777
# Purchase the desired rate. asynchronous=False indicates that the function will wait until the
7878
# carrier returns a shipping label before it returns

0 commit comments

Comments
 (0)