Skip to content

Commit

Permalink
fix: clean _callback function
Browse files Browse the repository at this point in the history
  • Loading branch information
montezdesousa committed May 15, 2024
1 parent 2db438e commit fd2fe2c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd2fe2c

Please sign in to comment.