Use the following guide to assist in the upgrade process of the easypost-python
library between major versions.
Likelihood of Impact: High
Python 3.6 Required
easypost-python now requires Python 3.6 or greater and has dropped support for Python 2.
Dependencies
All dependencies had minor version bumps.
Previously the shipment.lowest_rate()
function expected a comma separated string list of filter criteria (carriers and services). These params have been corrected to expect an actual list object.
# Previous expectation
shipment.lowest_rate(carriers="USPS,FedEx", services="...")
# Current expectation
shipment.lowest_rate(carriers=["USPS", "FedEx"], services="...")
Likelihood of Impact: Medium
The HTTP method used for the get_rates
endpoint at the API level has changed from POST
to GET
and will only retrieve rates for a shipment instead of regenerating them. A new /rerate
endpoint has been introduced to replace this functionality; In this library, you can now call the shipment.regenerate_rates()
method to regenerate rates. Due to the logic change, the get_rates
method has been removed since a Shipment inherently already has rates associated.
Likelihood of Impact: High
Dependencies
Bumps the requests
library from v1 to v2.
Likelihood of Impact: High
All POST
and PUT
request bodies are now JSON encoded instead of form-encoded. You may see subtle inconsistencies to how certain data types were previously sent to the API. We have taken steps to mitigate and test against these edge cases.