Metadata-Version: 2.4
Name: freightapis
Version: 1.0.0
Summary: Python SDK for FreightAPIs — NMFC freight classification, multi-carrier terminal locations, and global seaport data.
Author: FreightAPIs
License: MIT
Project-URL: Homepage, https://freightapis.dev/docs
Project-URL: Documentation, https://freightapis.dev/docs
Project-URL: Repository, https://github.com/buildinpublichub/freightapis.dev
Keywords: freight,nmfc,ltl,shipping,logistics,carrier,terminal,seaport,api
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: requests
Requires-Dist: requests>=2; extra == "requests"
Dynamic: license-file

# freightapis (Python)

Tiny client for [FreightAPIs](https://freightapis.dev) — NMFC freight classification, multi-carrier terminal locations, and global seaports. Uses `requests` if installed, else the stdlib (zero required dependencies).

```bash
pip install freightapis
```

## Usage

```python
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`:

```python
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.
