mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-28 20:23:36 +00:00
* refactored benzinga provider directory * refactored fmp provider directory * refactor fred provider directory * added polygon provider directory * replace fmp .helpers * fix bad replace * redirect imports * remove standard import comment * remove internal import comment * ruff * remove third-party import comment * fix fred bad import * ruff * codespell --------- Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
15 lines
355 B
Python
15 lines
355 B
Python
# IMPORT THIRD PARTY
|
|
import requests
|
|
|
|
|
|
def get_data(url: str) -> dict:
|
|
r = requests.get(url, timeout=10)
|
|
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()
|