mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 21:42:22 +00:00
More linting
This commit is contained in:
@@ -52,7 +52,11 @@ class OECDGDPNomFetcher(Fetcher[OECDGDPNomQueryParams, List[OECDGDPNomData]]):
|
||||
**kwargs: Any,
|
||||
) -> dict:
|
||||
unit = "MLN_USD" if query.units == "usd" else "USD_CAP"
|
||||
url = f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.TOT.{unit}.A/OECD?contentType=csv&detail=code&separator=comma&csv-lang=en&startPeriod={query.start_date}&endPeriod={query.end_date}"
|
||||
url = (
|
||||
f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.TOT.{unit}.A/OECD"
|
||||
"?contentType=csv&detail=code&separator=comma&csv-lang=en"
|
||||
f"&startPeriod={query.start_date}&endPeriod={query.end_date}"
|
||||
)
|
||||
data_df = helpers.fetch_data(url, csv_kwargs={"encoding": "utf-8"}, **kwargs)
|
||||
# Sometimes there is weird unicode characters in the column names, so we need to rename them.
|
||||
# Even changing the encoding on the fetch doesn't seem to help.
|
||||
|
||||
@@ -61,7 +61,11 @@ class OECDGDPRealFetcher(Fetcher[OECDGDPRealQueryParams, List[OECDGDPRealData]])
|
||||
**kwargs: Any,
|
||||
) -> dict:
|
||||
units = {"qoq": "PC_CHGPP", "yoy": "PC_CHGPY", "idx": "IDX"}[query.units]
|
||||
url = f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.QGDP.{'VOLIDX' if units == 'IDX' else 'TOT'}.{units}.Q/OECD?contentType=csv&detail=code&separator=comma&csv-lang=en&startPeriod={query.start_date}&endPeriod={query.end_date}"
|
||||
url = (
|
||||
f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.QGDP.{'VOLIDX' if units == 'IDX' else 'TOT'}"
|
||||
f".{units}.Q/OECD?contentType=csv&detail=code&separator=comma&csv-lang=en"
|
||||
f"&startPeriod={query.start_date}&endPeriod={query.end_date}"
|
||||
)
|
||||
data_df = helpers.fetch_data(url, csv_kwargs={"encoding": "utf-8"}, **kwargs)
|
||||
# Sometimes there is weird unicode characters in the column names, so we need to rename them.
|
||||
# Even changing the encoding on the fetch doesn't seem to help.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import datetime
|
||||
|
||||
import pytest
|
||||
from openbb_core.app.service.user_service import UserService
|
||||
from openbb_oecd.models.gdpforecast import OECDGDPForecastFetcher
|
||||
from openbb_oecd.models.gdpnom import OECDGDPNomFetcher
|
||||
from openbb_oecd.models.gdpreal import OECDGDPRealFetcher
|
||||
from openbb_oecd.models.gdpforecast import OECDGDPForecastFetcher
|
||||
|
||||
test_credentials = UserService().default_user_settings.credentials.dict()
|
||||
|
||||
|
||||
@@ -540,11 +540,6 @@ def get_gdp(
|
||||
no_data_message(error=str(e))
|
||||
return df
|
||||
|
||||
print(
|
||||
f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.TOT.{units_dict[units]}.A/OECD?contentType=csv&detail=code"
|
||||
f"&separator=comma&csv-lang=en&startPeriod={start_date}&endPeriod={end_date}"
|
||||
)
|
||||
|
||||
df = df.iloc[:, [0, 5]]
|
||||
|
||||
result = pd.DataFrame()
|
||||
|
||||
Reference in New Issue
Block a user