python-bcb 0.4.1__py3-none-any.whl → 0.4.2__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.
bcb/odata/api.py CHANGED
@@ -409,11 +409,27 @@ class BaseODataAPI:
409
409
  DATE_COLUMNS: list[str] = []
410
410
  PARAMETER_FORMATTERS: dict[str, Callable[[Any], Any]] = {}
411
411
 
412
- def __init__(self, *, timeout: RequestTimeout = None) -> None:
412
+ def __init__(
413
+ self,
414
+ *,
415
+ timeout: RequestTimeout = None,
416
+ parameter_formatters: Optional[dict[str, Callable[[Any], Any]]] = None,
417
+ ) -> None:
413
418
  """
414
419
  BaseODataAPI construtor
420
+
421
+ Parameters
422
+ ----------
423
+
424
+ parameter_formatters : dict[str, Callable], optional
425
+ Formatadores de parâmetros dos *function imports*, indexados pelo
426
+ nome do parâmetro. Cada função recebe o valor informado e retorna
427
+ o valor usado no literal OData. Esses formatadores são aplicados
428
+ sobre os definidos em ``PARAMETER_FORMATTERS``, podendo
429
+ complementá-los ou substituí-los.
415
430
  """
416
431
  self._timeout = timeout
432
+ self._parameter_formatters = dict(parameter_formatters or {})
417
433
  self.service = ODataService(self.BASE_URL, timeout=timeout)
418
434
 
419
435
  def describe(self, endpoint: Optional[str] = None, *, full: bool = True) -> None:
@@ -463,11 +479,15 @@ class BaseODataAPI:
463
479
  ValueError
464
480
  Se o *endpoint* fornecido é errado.
465
481
  """
482
+ parameter_formatters = {
483
+ **self.PARAMETER_FORMATTERS,
484
+ **self._parameter_formatters,
485
+ }
466
486
  return Endpoint(
467
487
  self.service[endpoint],
468
488
  self.service.url,
469
489
  self.DATE_COLUMNS or None,
470
- self.PARAMETER_FORMATTERS or None,
490
+ parameter_formatters or None,
471
491
  timeout=self._timeout,
472
492
  )
473
493
 
@@ -483,7 +503,13 @@ class ODataAPI(BaseODataAPI):
483
503
  não possuem implementação específica.
484
504
  """
485
505
 
486
- def __init__(self, url: str, *, timeout: RequestTimeout = None) -> None:
506
+ def __init__(
507
+ self,
508
+ url: str,
509
+ *,
510
+ timeout: RequestTimeout = None,
511
+ parameter_formatters: Optional[dict[str, Callable[[Any], Any]]] = None,
512
+ ) -> None:
487
513
  """
488
514
  Parameters
489
515
  ----------
@@ -499,8 +525,13 @@ class ODataAPI(BaseODataAPI):
499
525
 
500
526
  - Expectativas
501
527
  - PTAX
528
+ parameter_formatters : dict[str, Callable], optional
529
+ Formatadores de parâmetros dos *function imports*, indexados pelo
530
+ nome do parâmetro. Cada função recebe o valor informado e retorna
531
+ o valor usado no literal OData.
502
532
  """
503
533
  self._timeout = timeout
534
+ self._parameter_formatters = dict(parameter_formatters or {})
504
535
  self.service = ODataService(url, timeout=timeout)
505
536
 
506
537
 
@@ -1,9 +1,29 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-bcb
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Interface Python para APIs de dados abertos do Banco Central do Brasil.
5
+ Project-URL: Homepage, https://github.com/wilsonfreitas/python-bcb
6
+ Project-URL: Documentation, https://wilsonfreitas.github.io/python-bcb/
7
+ Project-URL: Repository, https://github.com/wilsonfreitas/python-bcb
8
+ Project-URL: Issues, https://github.com/wilsonfreitas/python-bcb/issues
9
+ Project-URL: Changelog, https://github.com/wilsonfreitas/python-bcb/blob/main/CHANGELOG.md
5
10
  Author-email: wilsonfreitas <wilson.freitas@gmail.com>
11
+ License-Expression: MIT
6
12
  License-File: LICENSE
13
+ Keywords: banco central do brasil,bcb,dados abertos,economics,expectativas,finance,focus,ifdata,odata,open data,ptax,sgs,time series
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Financial and Insurance Industry
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: Natural Language :: Portuguese (Brazilian)
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Topic :: Office/Business :: Financial
26
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
7
27
  Requires-Python: >=3.10
8
28
  Requires-Dist: httpx>=0.24.0
9
29
  Requires-Dist: lxml>=4.9.2
@@ -221,6 +241,6 @@ A saída HTML é gerada em `docs/_build/html`. Edite os arquivos fonte em `docs/
221
241
  ### P: Onde encontro documentação mais detalhada?
222
242
  **R:**
223
243
  - [Documentação de API](https://wilsonfreitas.github.io/python-bcb/)
224
- - [Diretório de Exemplos](./examples/)
244
+ - [Diretório de Exemplos](https://github.com/wilsonfreitas/python-bcb/tree/main/examples)
225
245
  - Docstrings inline: `help(bcb.sgs.get)`, `help(bcb.currency.get)`, etc.
226
246
  - [Portal de Dados Abertos BCB](https://dadosabertos.bcb.gov.br/)
@@ -4,11 +4,11 @@ bcb/exceptions.py,sha256=gnREvUECVbsb-f57uLSkl8hD7ITmSvXuT2y5ycpVHlk,912
4
4
  bcb/http.py,sha256=P9btc_w6sljWXv_QsOzKt5jvCAnBMxZ6AjH6JxHvIQU,4960
5
5
  bcb/utils.py,sha256=HHrEpEM9b2nEVmPEBU0nV__47HeAUCKkfbx9pYQhYQ4,1751
6
6
  bcb/odata/__init__.py,sha256=O9dLRmMa6jq18ICAEK-cRfZNRJPtRFSWVqqeD_8VB98,410
7
- bcb/odata/api.py,sha256=XAQLhATmstu8Nuu3kYX8AePxmK1-qvMGf6bOiDqH_O4,28093
7
+ bcb/odata/api.py,sha256=MAaHXwqC8BQBIDZc3aogNNWC3znjq6uTaVZsBvNGTsk,29304
8
8
  bcb/odata/framework.py,sha256=HGXOV9W0J_o8uYgGcvL63dxPfaa1mOtMdgXn1kbP4cI,28116
9
9
  bcb/sgs/__init__.py,sha256=q_XG8m7mC89kyhoscqZmeNfIJTGIHN9fdO2ZoIw-eQk,19499
10
10
  bcb/sgs/regional_economy.py,sha256=6lM03D0RguUujNJ_48845-WAUp40CIJkC7Fycpm9iQQ,7284
11
- python_bcb-0.4.1.dist-info/METADATA,sha256=wItP2EQDfqnKB0Bpm2M-_6WBYYE24h4gtv7oHXTA0cY,9101
12
- python_bcb-0.4.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
13
- python_bcb-0.4.1.dist-info/licenses/LICENSE,sha256=PK0tDWJUgRdeZCmA39ZHQu8v2ozAOl49qEaDEcntbAA,1070
14
- python_bcb-0.4.1.dist-info/RECORD,,
11
+ python_bcb-0.4.2.dist-info/METADATA,sha256=0mRbM4j1U6BHqZWy4vPYjPqWC_WyAWGMOHCPNHcL7dk,10360
12
+ python_bcb-0.4.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
13
+ python_bcb-0.4.2.dist-info/licenses/LICENSE,sha256=PK0tDWJUgRdeZCmA39ZHQu8v2ozAOl49qEaDEcntbAA,1070
14
+ python_bcb-0.4.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any