bradtreloar / couriersplease-python-client

Python library for Couriers Please API
GNU General Public License v3.0
0 stars 0 forks source link

Pickup API V2 fields smaller than corresponding Shipment API fields #3

Open bradtreloar opened 6 years ago

bradtreloar commented 6 years ago

It would be useful for the API to use the pickup and destination addresses from a shipment to create a pickup, rather than requiring the user/developer to input the 'from' address in two places and two different formats.

bradtreloar commented 6 years ago

Need to condense two 100-character fields into three 19-character fields for the street address.

May be able to solve with an algorithm that uses regexp to abbreviate syntax such as "Unit" and "Level" and replace street name suffixes with standard abbreviations (e.g. "Boulevard" => "Blvd").

May also be able to drop building name but only if property/lot number is given.

bradtreloar commented 6 years ago

I've added a utility class Address that can try to compress an address into a set of small fields, but it cannot provide a surefire way to condense two 100-character fields into three 19-character fields. However, it can compress addresses that are slightly too large for the Pickup API.

Ultimately it may be up to individual developers to decide how they want to compress/truncate addresses and what limitations they want to impose on their users.