Commit 8e244d0b authored by Bruno Duyé's avatar Bruno Duyé Committed by Bruno Duyé

Fix: dbnomics.api_base_url ignored

parent a7efb003
Pipeline #85402 passed with stage
in 37 seconds
......@@ -38,7 +38,7 @@ dataframe = fetch_series(
)
```
Or set the default API URL by [monkey-patching](https://en.wikipedia.org/wiki/Monkey_patch) the `dbnomics` module, like this:
Or globally change the default API URL used by the `dbnomics` module, like this:
```python
import dbnomics
......
......@@ -62,7 +62,7 @@ class TooManySeries(Exception):
def fetch_series(provider_code=None, dataset_code=None, series_code=None, dimensions=None, series_ids=None,
max_nb_series=None, api_base_url=default_api_base_url,
max_nb_series=None, api_base_url=None,
editor_api_base_url=default_editor_api_base_url, filters=None):
"""Download time series from DBnomics. Filter series by different ways according to the given parameters.
......@@ -108,6 +108,9 @@ def fetch_series(provider_code=None, dataset_code=None, series_code=None, dimens
fetch_series('AMECO/ZUTN/EA19.1.0.0.0.ZUTN', filters=[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}])
"""
# Parameters validation
global default_api_base_url
if api_base_url is None:
api_base_url = default_api_base_url
if not api_base_url.endswith('/'):
api_base_url += "/"
if dataset_code is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment