notoecd 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
notoecd/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.5"
1
+ __version__ = "0.1.6"
2
2
 
3
3
  from .calls import get_df
4
4
  from .structure import get_structure
notoecd/calls.py CHANGED
@@ -97,14 +97,21 @@ def get_df(
97
97
  else:
98
98
  filter_expression = _clean(filters).upper()
99
99
 
100
- url = (
101
- f"https://sdmx.oecd.org/public/rest/data/"
102
- f"{agencyID},{dataflowID},{version}/{filter_expression}"
103
- f"?dimensionAtObservation=AllDimensions&format=csvfile"
104
- )
105
-
106
- if startYear is not None: url += f"&startPeriod={startYear}"
107
- if endYear is not None: url += f"&endPeriod={endYear}"
108
-
109
- base_df = _fetch_df(url)
110
- return base_df.copy()
100
+ def build_url(ver: str) -> str:
101
+ url = (
102
+ f"https://sdmx.oecd.org/public/rest/data/"
103
+ f"{agencyID},{dataflowID},{ver}/{filter_expression}"
104
+ f"?dimensionAtObservation=AllDimensions&format=csvfile"
105
+ )
106
+ if startYear is not None: url += f"&startPeriod={startYear}"
107
+ if endYear is not None: url += f"&endPeriod={endYear}"
108
+ return url
109
+
110
+ versions_to_try = [version] if version else ["", "2", "1"]
111
+ last_err: Exception | None = None
112
+
113
+ for ver in versions_to_try:
114
+ try: return _fetch_df(build_url(ver)).copy()
115
+ except Exception as e: last_err = e
116
+
117
+ raise last_err
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notoecd
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Unofficial library for interacting with the OECD Data Explorer through Python.
5
5
  Author-email: Daniel Vegara Balsa <daniel.vegarabalsa@oecd.org>
6
6
  License-Expression: MIT
@@ -0,0 +1,9 @@
1
+ notoecd/__init__.py,sha256=xd8luxA_Bd8ya9XUHTb2_hWIN3rtkP5qopH5My9BLQI,189
2
+ notoecd/calls.py,sha256=SFJiYELGPKU3XOSJwPmdSabYX9JhTFieGm1cbCFGzdI,3679
3
+ notoecd/datasets.py,sha256=BTDgdhOK6tJrU0fp_7GZQOoTpOf4CRQrqDVkXcvpAcU,3818
4
+ notoecd/structure.py,sha256=ur8kkdCL2zRjCVrw1grtyCRNZ-aqHKRgv9X_a_6qtDQ,7349
5
+ notoecd-0.1.6.dist-info/licenses/LICENSE,sha256=jb9xgeCKfW-VCXFQtYmiM_SZ9tC2zPGtOIVsE5G17W8,1076
6
+ notoecd-0.1.6.dist-info/METADATA,sha256=AhjL-SKDfGt7H82GdT2gn4oEpGLHq2y31uRo6IpxKw8,2755
7
+ notoecd-0.1.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
8
+ notoecd-0.1.6.dist-info/top_level.txt,sha256=GrcbH10OAguGh5dkpzst216N_C-NtZ-QF1nlXiUpeLs,8
9
+ notoecd-0.1.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- notoecd/__init__.py,sha256=v397Mb7CzA-dmcZYLK6AiEesjCf3ugEv0keEVFh8bz4,189
2
- notoecd/calls.py,sha256=wy7ELlMLl6X5bEN7V4Pn-AcV8YYqAUPWzL-9uT-1NzM,3400
3
- notoecd/datasets.py,sha256=BTDgdhOK6tJrU0fp_7GZQOoTpOf4CRQrqDVkXcvpAcU,3818
4
- notoecd/structure.py,sha256=ur8kkdCL2zRjCVrw1grtyCRNZ-aqHKRgv9X_a_6qtDQ,7349
5
- notoecd-0.1.5.dist-info/licenses/LICENSE,sha256=jb9xgeCKfW-VCXFQtYmiM_SZ9tC2zPGtOIVsE5G17W8,1076
6
- notoecd-0.1.5.dist-info/METADATA,sha256=hnnWK8pgdyajFl71f3hLsS3-QP_vYdapjYnQK-E9YNM,2755
7
- notoecd-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- notoecd-0.1.5.dist-info/top_level.txt,sha256=GrcbH10OAguGh5dkpzst216N_C-NtZ-QF1nlXiUpeLs,8
9
- notoecd-0.1.5.dist-info/RECORD,,