(parcels)
A parcel is an item you are shipping. The parcel object includes details about its physical make-up of the parcel. It includes dimensions and weight that Shippo uses to calculate rates.
The following values are supported for the extra field of the parcel object.
Returns a list of all parcel objects.
from shippo import Shippo
with Shippo(
api_key_header="<YOUR_API_KEY_HERE>",
shippo_api_version="2018-02-08",
) as s_client:
res = s_client.parcels.list()
assert res is not None
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
page |
Optional[int] | ➖ | The page number you want to select |
results |
Optional[int] | ➖ | The number of results to return per page (max 100) |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
components.ParcelPaginatedList
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
Creates a new parcel object.
from shippo import Shippo
from shippo.models import components
with Shippo(
api_key_header="<YOUR_API_KEY_HERE>",
shippo_api_version="2018-02-08",
) as s_client:
res = s_client.parcels.create(request={
"mass_unit": components.WeightUnitEnum.LB,
"weight": "1",
"distance_unit": components.DistanceUnitEnum.IN,
"height": "1",
"length": "1",
"width": "1",
"extra": {
"cod": {
"amount": "5.5",
"currency": "USD",
"payment_method": components.PaymentMethod.CASH,
},
"insurance": {
"amount": "5.5",
"content": "Laptop",
"currency": "USD",
"provider": components.ParcelInsuranceProvider.UPS,
},
},
"metadata": "Customer ID 123456",
})
assert res is not None
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CreateParcelRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
Returns parcel details using an existing parcel object ID (this will not return parcel details associated with un-purchased shipment/rate parcel object IDs).
from shippo import Shippo
with Shippo(
api_key_header="<YOUR_API_KEY_HERE>",
shippo_api_version="2018-02-08",
) as s_client:
res = s_client.parcels.get(parcel_id="<id>")
assert res is not None
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
parcel_id |
str | ✔️ | Object ID of the parcel |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |