Skip to content

Errors

stormlore.errors

Every error the SDK raises.

All of them derive from :class:StormloreError. Errors the API answered with are :class:APIError subclasses chosen by the API's machine-readable error code, and carry code, message, http_status, request_id and attempts (how many requests were sent, retries included).

StormloreError

Bases: Exception

Base class of every error the SDK raises.

MissingApiKeyError

Bases: StormloreError

No API key was given and WXCHANGE_API_KEY is unset or blank.

MissingExtraError

Bases: StormloreError, ImportError

A feature needs an optional dependency that is not installed.

UnknownZipError

Bases: StormloreError, ValueError

A ZIP code given as a place has no ZIP Code Tabulation Area on the API.

ZipLookupForbiddenError

Bases: StormloreError

The API key may not look up ZIP codes (it lacks the read:observations scope).

UnitConversionError

Bases: StormloreError, ValueError

A value cannot be converted to the requested units.

ConnectionError

Bases: StormloreError

The API could not be reached, or the response did not arrive in time.

timed_out is true when the request was sent but the response took longer than the client's timeout; such a request is never replayed.

APIError

Bases: StormloreError

The API answered with an error.

Attributes:

Name Type Description
code

The API's machine-readable error code (None when the body was not the API's JSON, e.g. a proxy's error page).

message

The API's human-readable message.

http_status

The HTTP status code.

request_id

The x-request-id response header, when sent; quote it to support.

attempts

How many requests were sent, retries included.

body

The parsed JSON body, when there was one.

InvalidRequestError

Bases: APIError

The request was malformed (400): a bad datetime, bounds, size or argument.

UnauthorizedError

Bases: APIError

The API key is missing, invalid, expired or revoked (401).

ForbiddenError

Bases: APIError

The API key lacks the scope this operation needs (403 forbidden).

SubscribeRequiredError

Bases: ForbiddenError

The model (or source) is listed in the catalog but this account has not subscribed.

model_id (or source) names it, for a subscribe link.

PaymentRequiredError

Bases: APIError

The listing is paid (402).

NotFoundError

Bases: APIError

Something named in the request does not exist (404).

ModelNotFoundError

Bases: NotFoundError

No such model, or the account may not see it.

ParameterNotFoundError

Bases: NotFoundError

The model has no such parameter.

RunNotFoundError

Bases: NotFoundError

The model has no such run.

StepNotFoundError

Bases: NotFoundError

The run has no such forecast step.

ObservationNotFoundError

Bases: NotFoundError

No such observation.

ObservationSourceNotFoundError

Bases: NotFoundError

No such observation source, or the account may not read it.

AdvisoryNotFoundError

Bases: NotFoundError

No such advisory.

AdvisoriesUnavailableError

Bases: APIError

This deployment serves no advisories.

ZipsUnavailableError

Bases: APIError

This deployment has no ZIP reference data.

ZipsTooManyError

Bases: InvalidRequestError

Too many ZIP codes for one answer (413 zips_too_many); count says how many.

ZipsTooLargeError

Bases: InvalidRequestError

The ZIP shapes asked for exceed what one answer may carry (413 zips_too_large).

PointOutOfBoundsError

Bases: APIError

The point lies outside the model's grid (422).

DatetimeOutOfRangeError

Bases: APIError

The time is outside the run's coverage (422).

DatetimeInGapError

Bases: APIError

The time falls in a gap between an analysis model's frames (422).

body carries before, after, gap_s and max_gap_s.

RateLimitError

Bases: APIError

Too many requests (429). retry_after is the seconds to wait, when the API said.

KeyCapExceededError

Bases: RateLimitError

The API key has spent the monthly call cap its organization set (429 key_cap_exceeded).

Never retried: it lifts when the cap is raised or the UTC month turns. cap is the X-Sentinel-Cap header, "<used>/<limit>", when the API sent it.

ServiceUnavailableError

Bases: APIError

The API is temporarily unable to answer (502/503). Retried automatically.

LoadingError

Bases: ServiceUnavailableError

The API is still loading data (503 loading). Retried automatically.

OverloadedError

Bases: ServiceUnavailableError

The request was shed, not run (503 overloaded). Retried automatically.

UpstreamUnavailableError

Bases: ServiceUnavailableError

A dependency of the API is down (503 upstream_unavailable); service names it.

InternalServerError

Bases: APIError

The API failed (500 internal_error). Quote request_id to support.