Skip to main content

Shippo logo Shippo Python SDK

Shippo is a shipping API that connects you with multiple shipping carriers (such as USPS, UPS, DHL, Canada Post, Australia Post, and many others) through one interface.

You must register for a Shippo account to use our API. It's free to sign up. Only pay to print a live label, test labels are free.

To use the API, you must generate an API Token. In the following examples, replace <YOUR_API_KEY_HERE> with your own token.

For example.

api_key_header="shippo_test_595d9cb0c0e14497bf07e75ecfec6c6d"

Summary

Shippo external API.: Use this API to integrate with the Shippo service

Table of Contents

SDK Installation

The SDK can be installed using the pip package manager, with dependencies and metadata stored in the setup.py file.

pip install shippo

SDK Reinstallation to a specific version

pip install --force-reinstall -I shippo==3.4.4

SDK Example Usage

Example

import shippo

shippo_sdk = shippo.Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    # the API version can be globally set, though this is normally not required
    # shippo_api_version='<YYYY-MM-DD>',
)

address_list = shippo_sdk.addresses.list()

if address_list is not None:
    # handle response
    pass

Custom HTTP Client

The Python SDK makes API calls using the requests HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session object.

For example, you could specify a header for every request that this sdk makes as follows:

import shippo
import requests

http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
s = shippo.Shippo(client=http_client)

Debug HTTP Client

The Shippo Python SDK returns schema models directly rather than wrapping the response in an envelope along with additional request/response details (status code, raw json, etc). However, there are times when the underlying http information is useful so a 'debug' client is provided. Using this client, you can retrieve the requests.PreparedRequest and requests.Response from the most recent API call.

import shippo
from shippo.debug import DebugSession

debug_session = DebugSession()
shippo_sdk = shippo.Shippo(api_key_header="<YOUR_API_KEY_HERE>", client=debug_session)

shippo_sdk.addresses.list()

# print the previous request http headers
print(debug_session.last_request.headers)  
# print the previous response status code and raw json
print(debug_session.last_response.status_code, debug_session.last_response.text)

Documentation

Review our full guides and references at https://docs.goshippo.com/.

Available Resources and Operations

Available methods

addresses

  • list - List all addresses
  • create - Create a new address
  • get - Retrieve an address
  • validate - Validate an address

batches

carrier_accounts

carrier_parcel_templates

  • list - List all carrier parcel templates
  • get - Retrieve a carrier parcel templates

customs_declarations

  • list - List all customs declarations
  • create - Create a new customs declaration
  • get - Retrieve a customs declaration

customs_items

  • list - List all customs items
  • create - Create a new customs item
  • get - Retrieve a customs item

manifests

  • list - List all manifests
  • create - Create a new manifest
  • get - Retrieve a manifest

orders

  • list - List all orders
  • create - Create a new order
  • get - Retrieve an order

parcels

  • list - List all parcels
  • create - Create a new parcel
  • get - Retrieve an existing parcel

pickups

rates

rates_at_checkout

refunds

  • create - Create a refund
  • list - List all refunds
  • get - Retrieve a refund

service_groups

  • list - List all service groups
  • create - Create a new service group
  • update - Update an existing service group
  • delete - Delete a service group

shipments

  • list - List all shipments
  • create - Create a new shipment
  • get - Retrieve a shipment

shippo_accounts

  • list - List all Shippo Accounts
  • create - Create a Shippo Account
  • get - Retrieve a Shippo Account
  • update - Update a Shippo Account

tracking_status

  • create - Register a tracking webhook
  • get - Get a tracking status

transactions

  • list - List all shipping labels
  • create - Create a shipping label
  • get - Retrieve a shipping label

user_parcel_templates

  • list - List all user parcel templates
  • create - Create a new user parcel template
  • delete - Delete a user parcel template
  • get - Retrieves a user parcel template
  • update - Update an existing user parcel template

webhooks

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release.

About Shippo

Connect with multiple different carriers, get discounted shipping labels, track parcels, and much more with just one integration. You can use your own carrier accounts or take advantage of our discounted rates with the Shippo carrier accounts. Using Shippo makes it easy to deal with multiple carrier integrations, rate shopping, tracking and other parts of the shipping workflow. We provide the API and web app for all your shipping needs.

Release files for shippo 3.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shippo 3.9.0
File Size Uploaded
shippo-3.9.0.tar.gz 110.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shippo 3.9.0
File Interpreter ABI Platform
shippo-3.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 385.7 kB

Release files / shippo-3.9.0.tar.gz

Download URL shippo-3.9.0.tar.gz
Size 110.2 kB
Tags Source
SHA-256 checksum
How to use checksums
85e4bbe5183aa2955e3db1b3ca5ac04b0d03200e3e7d80614bdd7b22ebdfcb38
BLAKE2b-256 checksum
How to use checksums
33f1fc91f5435a1486d73487a94c0c8c3127a664d9c21a089469aad72888bd99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Release files / shippo-3.9.0-py3-none-any.whl

Download URL shippo-3.9.0-py3-none-any.whl
Size 275.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be1a10e261637db733e70eae3c85814d49346622635e2e0ab278866c18d6410e
BLAKE2b-256 checksum
How to use checksums
3dbf0f501e35805e95efac128c8937a7a542c0ce5c18a3dad12139b64378a890
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Release history Release notifications | RSS feed

This release

3.9.0 This release

2 release files

3.8.1

2 release files

3.8.0

2 release files

3.7.1

2 release files

3.7.0

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.6

2 release files

3.4.5

2 release files

3.4.4

2 release files

3.4.3

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.5

2 release files

3.3.4

2 release files

3.3.3

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.2.8

2 release files

3.2.7

2 release files

3.2.6

2 release files

3.2.5

2 release files

3.2.4

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.1.2

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.6.2

2 release files

1.5.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

1 release file

1.1.0

1 release file

1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page