Skip to main content

freightapis (Python)

Tiny client for FreightAPIs — NMFC freight classification, multi-carrier terminal locations, and global seaports. Uses requests if installed, else the stdlib (zero required dependencies).

pip install freightapis

Usage

import os
from freightapis import FreightAPIs

fa = FreightAPIs(os.environ["FREIGHTAPIS_KEY"])

# Carrier locations
ga = fa.carrier_by_state_or_zip("estes", state="GA")
search = fa.carrier_search("saia", "atlanta")
cov = fa.carrier_coverage("abf", state="AR")
batch = fa.carrier_batch("usps", {"states": ["NY", "NJ"]})

# Seaports
cn = fa.ports_by_country("CN")
sh = fa.port("CNSHA")
near = fa.ports_nearby(31.2, 121.5, radius=200)
cosco = fa.ports_by_company("COSCO")

# NMFC classification (Pro plan)
cls = fa.nmfc_search("furniture")
art = fa.article("63321")
dens = fa.density({
    "dimensionType": "Inch", "weightType": "Pound", "resultUnitType": "PoundsPerCubicFeet",
    "unitDimensions": [{"HandlingUnitCount": 1, "length": 48, "width": 40, "height": 48, "handlingUnitWeight": 500}],
})

# Any endpoint not covered by a helper:
days = fa.request("GET", "/api/abf-location/service-days", query={"zip": "72401"})

Errors

Non-2xx responses raise FreightAPIError with .status and .body:

from freightapis import FreightAPIError
try:
    fa.article("does-not-exist")
except FreightAPIError as e:
    print(e.status, e.body)

API reference: https://freightapis.dev/docs · MIT licensed.

Metadata

Release files for freightapis 1.0.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 freightapis 1.0.0
File Size Uploaded
freightapis-1.0.0.tar.gz 4.4 kB Details

Built distribution (wheel)

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

Total release size: 9.1 kB

Release files / freightapis-1.0.0.tar.gz

Download URL freightapis-1.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ba94803a719aaeaf4fae7ce42a0b03dc39932376425f0cdf0d2e1e168b727067
BLAKE2b-256 checksum
How to use checksums
08df26f81a50f841aa8e4c3738f9acdc9ec1af23d793d2f2dfb907fe7cb42384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / freightapis-1.0.0-py3-none-any.whl

Download URL freightapis-1.0.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea2b1a5615581f6bcbe669064c807ad8ced3dcb4ffd306e83ae0f3617df281fb
BLAKE2b-256 checksum
How to use checksums
7215406845c3e6f8da846a47443b3f2cf612050dd6247f18c9d4295068a438f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 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