Python SDK for FreightAPIs — NMFC freight classification, multi-carrier terminal locations, and global seaport data.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba94803a719aaeaf4fae7ce42a0b03dc39932376425f0cdf0d2e1e168b727067
|
|
| MD5 |
23268330ec829e6bd6ea24d44c1ed916
|
|
| BLAKE2b-256 |
08df26f81a50f841aa8e4c3738f9acdc9ec1af23d793d2f2dfb907fe7cb42384
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea2b1a5615581f6bcbe669064c807ad8ced3dcb4ffd306e83ae0f3617df281fb
|
|
| MD5 |
a6db948d1897cde5540735c0d80f3b69
|
|
| BLAKE2b-256 |
7215406845c3e6f8da846a47443b3f2cf612050dd6247f18c9d4295068a438f8
|