mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-09 10:51:57 +00:00
* stash the work here * finish the job * also add most active * fix tmx etf countries * codespell * fix reference path in codespell * still didn't get the path right * linter * linter * unused-argument * fix polygon * fix tiingo * remove debug print * fix nasdaq * more lint * didn't save that file * fix bad url in error message * some review items --------- Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
22 lines
639 B
Python
22 lines
639 B
Python
"""Benzinga Helpers."""
|
|
|
|
from openbb_core.app.model.abstract.error import OpenBBError
|
|
from openbb_core.provider.utils.errors import UnauthorizedError
|
|
|
|
|
|
async def response_callback(response, _):
|
|
"""Response callback."""
|
|
# pylint: disable=import-outside-toplevel
|
|
results = await response.json()
|
|
if (
|
|
results
|
|
and isinstance(results, list)
|
|
and len(results) == 1
|
|
and isinstance(results[0], str)
|
|
):
|
|
if "access denied" in results[0].lower():
|
|
raise UnauthorizedError(f"Unauthorized Benzinga request -> {results[0]}")
|
|
raise OpenBBError(results[0])
|
|
|
|
return results
|