Registry / devops / shippo

shippo

JSON →
library3.9.0pypypi✓ verified 84d ago

Official Python library for the Shippo API (USPS, FedEx, UPS, DHL and 85+ carriers). Current version v3.9.0 supports async operations and webhooks. Monthly releases with beta previews. Requires Python >=3.8.

pip install shippo
INSTALL
IMPORT
SIG · SHIPPO
S
shippo
devopspythonv3.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Shippo
import shippo from shippo import Shippo
v3+ uses class-based client. v2 used module-level functions.
Address
from shippo.models import Address
Models have been reorganized in v3. Previously flat imports may fail.

Create a shipment with Shippo client. Requires SHIPPO_API_KEY env var.

import os import shippo client = shippo.Shippo(api_key=os.environ.get('SHIPPO_API_KEY', '')) address_from = { 'name': 'Shawn Ippotle', 'street1': '215 Clayton St.', 'city': 'San Francisco', 'state': 'CA', 'zip': '94117', 'country': 'US', } address_to = { 'name': 'Mr. Hippo', 'street1': '965 Mission St.', 'city': 'San Francisco', 'state': 'CA', 'zip': '94103', 'country': 'US', } def test_auth(): try: addr = client.shipments.create( address_from=address_from, address_to=address_to, parcels=[{ 'length': '5', 'width': '5', 'height': '5', 'distance_unit': 'in', 'weight': '2', 'mass_unit': 'lb' }] ) print('Success') except shippo.APIError as e: print(f'Error: {e}') test_auth()
Debug
Known issues
breakingv3.0 changed from module-level functions to class-based client. Old code using shippo.Shipment.create() will break.
fix
Use client = shippo.Shippo(api_key='...'); client.shipments.create(...)
affects: >=3.0.0
breakingDictionary format for addresses and parcels changed. Required fields and structure updated.
fix
See quickstart example for correct shape. Old 2.x code will raise validation errors.
affects: >=3.0.0
deprecatedshippo.Shippo.retrieve() and similar methods replaced with client.resource.get() or object retrieval via ID.
fix
Use client.shipments.retrieve(shipment_id) in v3.
affects: <3.0.0
gotchaAPI key must be passed to constructor, not set via environment variable automatically. shippo.config.api_key is not supported in v3.
fix
Pass key explicitly: Shippo(api_key='sk_...') or set SHIPPO_API_KEY env var and use os.environ.get().
affects: >=3.0.0
gotchaAsync client requires separate import: shippo.ShippoAsync. Mixing sync and async client for the same key may cause issues.
fix
Install with shippo[async] and use from shippo import ShippoAsync.
affects: >=3.5.0
Errors
Common errors & fixes
AttributeError: module 'shippo' has no attribute 'Shipment'
Old v2 code using module-level functions. v3 uses class-based client.
fix
Use client = shippo.Shippo(api_key='...'); client.shipments.create(...)
shippo.error.InvalidRequestError: Validation failed: 'address_from' is required
Missing or misspelled required fields in address dictionary (e.g., 'street1' instead of 'street').
fix
Check address dictionary for correct keys: name, street1, city, state, zip, country.
TypeError: 'Shippo' object is not callable
Trying to call the client instance as a function (e.g., Shippo() instead of Shippo(api_key='...')).
fix
Instantiate with Shippo(api_key='...') and use client methods.
requests.exceptions.ConnectionError: HTTPSConnectionPool
Network issue or wrong endpoint URL. v3 uses api.goshippo.com by default.
fix
Check network connectivity. If using proxy, configure environment variables.
Upgrade
Version history
3.9.0latest on PyPI · released Nov 26, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
shippo — pip install shippo · libregistry