mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-30 21:22:24 +00:00
16 lines
433 B
Python
16 lines
433 B
Python
# IMPORT THIRD PARTY
|
|
from openbb_provider import helpers
|
|
|
|
|
|
def get_data(url: str, **kwargs) -> dict:
|
|
"""Get data from Polygon endpoint."""
|
|
r = helpers.make_request(url, **kwargs)
|
|
if r.status_code != 200:
|
|
data = r.json()
|
|
message = data.get("message")
|
|
error = data.get("error")
|
|
value = message or error
|
|
raise RuntimeError(f"Error in Polygon request -> {value}")
|
|
|
|
return r.json()
|