summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjoaquim <henriquecjoaquim@gmail.com>2024-05-15 14:39:27 +0100
committerhjoaquim <henriquecjoaquim@gmail.com>2024-05-15 14:39:27 +0100
commita3c0f2077d32ec7472bdac6d1f7b986359a69095 (patch)
tree53b5d7ddd1bb4d5576a59ac7a67f9f059c9102f4
parentb983db69577de20c6a029d34d0941190404ee03d (diff)
parentfd2fe2c7fac84b05211335106c5207eeba64fd4e (diff)
Merge branch 'release/4.1.8' of github.com:OpenBB-finance/OpenBBTerminal into release/4.1.8release/4.1.8
-rw-r--r--openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py b/openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py
index 01c4c029372..b444c9e9f87 100644
--- a/openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py
+++ b/openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py
@@ -388,21 +388,21 @@ def get_indicator_countries(indicator: str) -> List[str]:
async def create_token(use_cache: bool = True) -> str:
"""Create a temporary token for the EconDB API."""
- async def _callback(response, session): # pylint: disable=W0613
+ async def _callback(_response, _):
"""Response callback function."""
try:
- return await response.json()
- except Exception as _:
+ return await _response.json()
+ except Exception as e:
raise RuntimeError(
"The temporary EconDB token could not be retrieved."
+ " Please try again later or provide your own token."
+ " Sign-up at: https://www.econdb.com/"
+ " Your IP address may have been flagged by Cloudflare."
- ) from _
+ ) from e
response: Union[dict, List[dict]] = {}
url = "https://www.econdb.com/user/create_token/?reset=0"
- if use_cache is True:
+ if use_cache:
cache_dir = f"{get_user_cache_directory()}/http/econdb_indicators_temp_token"
async with CachedSession(
cache=SQLiteBackend(cache_dir, expire_after=3600 * 12)