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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freightapis-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freightapis-1.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file freightapis-1.0.0.tar.gz.

File metadata

  • Download URL: freightapis-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for freightapis-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ba94803a719aaeaf4fae7ce42a0b03dc39932376425f0cdf0d2e1e168b727067
MD5 23268330ec829e6bd6ea24d44c1ed916
BLAKE2b-256 08df26f81a50f841aa8e4c3738f9acdc9ec1af23d793d2f2dfb907fe7cb42384

See more details on using hashes here.

File details

Details for the file freightapis-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: freightapis-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for freightapis-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea2b1a5615581f6bcbe669064c807ad8ced3dcb4ffd306e83ae0f3617df281fb
MD5 a6db948d1897cde5540735c0d80f3b69
BLAKE2b-256 7215406845c3e6f8da846a47443b3f2cf612050dd6247f18c9d4295068a438f8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page