Files
OpenBB/openbb_platform/providers/benzinga/openbb_benzinga/utils/helpers.py
Danglewood 2e3d8ef6b2 [Feature] Refactor FMP (#7217)
* 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>
2025-10-06 23:34:19 +00:00

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