Repository navigation
v0.4.0
This release adds a proper exception hierarchy so HTTP failures are classified and catchable by type.
Typed HTTP errors
HTTP failures now raise a MassiveApiHTTPError (or a specific subclass) instead of a raw
aiohttp.ClientResponseError. Each carries the status and the server message:
AuthenticationError— 401 / 403 (missing/invalid key or insufficient entitlement)NotFoundError— 404 (resource does not exist)ServerError— 5xx (a fault on the Massive API side)MassiveApiHTTPError— the base class, for any other non-2xx status
from massive_api import AuthenticationError, ServerError
try:
tickers = await api.reference_api.get_all_tickers(market="stocks")
except AuthenticationError:
... # check your API key
except ServerError as e:
... # transient upstream fault, status in e.statusAll of the above (plus the base MassiveApiError and MaxRetriesExceededError) are exported from
the top-level massive_api package.