Hydro-Quebec-API-Wrapper 3.1.1__tar.gz → 3.1.2__tar.gz

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.
Files changed (99) hide show
  1. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/.gitlab-ci.yml +5 -5
  2. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/.pre-commit-config.yaml +5 -4
  3. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/Hydro_Quebec_API_Wrapper.egg-info/PKG-INFO +1 -1
  4. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/Hydro_Quebec_API_Wrapper.egg-info/requires.txt +1 -1
  5. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/PKG-INFO +1 -1
  6. Hydro-Quebec-API-Wrapper-3.1.2/conflict_test_requirements.txt +1 -0
  7. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/examples/hydro.py +12 -10
  8. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/setup.cfg +1 -1
  9. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/test_requirements.txt +5 -5
  10. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_common.py +47 -13
  11. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_contract_dt.py +46 -28
  12. Hydro-Quebec-API-Wrapper-3.1.1/conflict_test_requirements.txt +0 -1
  13. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/.coveragerc +0 -0
  14. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/.flake8 +0 -0
  15. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/.gitignore +0 -0
  16. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/.pylintrc +0 -0
  17. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/Hydro_Quebec_API_Wrapper.egg-info/SOURCES.txt +0 -0
  18. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/Hydro_Quebec_API_Wrapper.egg-info/dependency_links.txt +0 -0
  19. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/Hydro_Quebec_API_Wrapper.egg-info/entry_points.txt +0 -0
  20. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/Hydro_Quebec_API_Wrapper.egg-info/top_level.txt +0 -0
  21. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/LICENSE +0 -0
  22. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/MANIFEST.in +0 -0
  23. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/README.md +0 -0
  24. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/config.default.yaml +0 -0
  25. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/Makefile +0 -0
  26. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/make.bat +0 -0
  27. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/_static/custom.css +0 -0
  28. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/_static/hydroqc-logo-128.png +0 -0
  29. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/_static/hydroqc-logo.svg +0 -0
  30. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/conf.py +0 -0
  31. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/external/description-des-codes-interruption.pdf +0 -0
  32. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/index.rst +0 -0
  33. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.contract.rst +0 -0
  34. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.hydro_api.rst +0 -0
  35. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.peak.cpc.rst +0 -0
  36. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.peak.dpc.rst +0 -0
  37. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.peak.rst +0 -0
  38. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.rst +0 -0
  39. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/hydroqc.types.rst +0 -0
  40. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/reference/modules.rst +0 -0
  41. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/docs/source/todo.rst +0 -0
  42. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/__init__.py +0 -0
  43. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/account.py +0 -0
  44. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/consts.py +0 -0
  45. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/__init__.py +0 -0
  46. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/common.py +0 -0
  47. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_d.py +0 -0
  48. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_d_cpc.py +0 -0
  49. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_dpc.py +0 -0
  50. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_dt.py +0 -0
  51. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_m.py +0 -0
  52. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_m_gdp.py +0 -0
  53. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/contract_residential.py +0 -0
  54. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/contract/outage.py +0 -0
  55. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/customer.py +0 -0
  56. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/diagnostic.py +0 -0
  57. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/error.py +0 -0
  58. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/hydro_api/__init__.py +0 -0
  59. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/hydro_api/cache.py +0 -0
  60. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/hydro_api/client.py +0 -0
  61. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/hydro_api/consts.py +0 -0
  62. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/logger.py +0 -0
  63. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/__init__.py +0 -0
  64. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/cpc/__init__.py +0 -0
  65. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/cpc/consts.py +0 -0
  66. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/cpc/handler.py +0 -0
  67. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/cpc/peak.py +0 -0
  68. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/dpc/__init__.py +0 -0
  69. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/dpc/consts.py +0 -0
  70. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/dpc/handler.py +0 -0
  71. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/peak/dpc/peak.py +0 -0
  72. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/py.typed +0 -0
  73. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/timerange.py +0 -0
  74. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/__init__.py +0 -0
  75. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/account.py +0 -0
  76. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/common.py +0 -0
  77. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/consump.py +0 -0
  78. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/contract.py +0 -0
  79. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/cpc.py +0 -0
  80. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/dpc.py +0 -0
  81. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/dt.py +0 -0
  82. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/types/outage.py +0 -0
  83. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/utils.py +0 -0
  84. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/hydroqc/webuser.py +0 -0
  85. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/logo/hydroqc-logo-128.png +0 -0
  86. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/logo/hydroqc-logo.svg +0 -0
  87. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/pyproject.toml +0 -0
  88. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/renovate.json5 +0 -0
  89. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/__init__.py +0 -0
  90. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/conftest.py +0 -0
  91. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_contract_d.py +0 -0
  92. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_contract_d_cpc.py +0 -0
  93. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_contract_dpc.py +0 -0
  94. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_contract_m.py +0 -0
  95. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/subtest_contract_m_gdp.py +0 -0
  96. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/test_basic.py +0 -0
  97. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/test_timerange.py +0 -0
  98. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tests/tools.py +0 -0
  99. {Hydro-Quebec-API-Wrapper-3.1.1 → Hydro-Quebec-API-Wrapper-3.1.2}/tox.ini +0 -0
@@ -31,7 +31,7 @@ test:
31
31
  stage: test
32
32
  tags:
33
33
  - hydroqc
34
- image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:049f7935029b57bdb18554561581fde63e454fc51be38b89214ff8dc9de35db0
34
+ image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:c2f84259e74c1bbd73497ee0d5a71fb5d8f8ff68befdd90f2f5e9b282da0f709
35
35
  script:
36
36
  - pip install tox
37
37
  - tox -e pylint,flake8,pydocstyle,typing,black,deps-conflict --parallel auto
@@ -70,7 +70,7 @@ test:
70
70
  stage: private_tests
71
71
  tags:
72
72
  - hydroqc
73
- image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:049f7935029b57bdb18554561581fde63e454fc51be38b89214ff8dc9de35db0
73
+ image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:c2f84259e74c1bbd73497ee0d5a71fb5d8f8ff68befdd90f2f5e9b282da0f709
74
74
  script:
75
75
  #- apt update && apt install -y jq unzip curl
76
76
  - >
@@ -258,7 +258,7 @@ private_tests_done:
258
258
  stage: private_tests_done
259
259
  tags:
260
260
  - hydroqc
261
- image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:049f7935029b57bdb18554561581fde63e454fc51be38b89214ff8dc9de35db0
261
+ image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:c2f84259e74c1bbd73497ee0d5a71fb5d8f8ff68befdd90f2f5e9b282da0f709
262
262
  script:
263
263
  #- apt-get update && apt-get install --no-install-recommends -y python3.10 python3-venv python3-pip --no-install-recommends git
264
264
  - echo "Private Tests done"
@@ -301,7 +301,7 @@ package:
301
301
  stage: test
302
302
  tags:
303
303
  - hydroqc
304
- image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:049f7935029b57bdb18554561581fde63e454fc51be38b89214ff8dc9de35db0
304
+ image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:c2f84259e74c1bbd73497ee0d5a71fb5d8f8ff68befdd90f2f5e9b282da0f709
305
305
  script:
306
306
  # Build a package with a version based on the commmit short sha
307
307
  - pip install --upgrade pip
@@ -331,7 +331,7 @@ promote2pypi:
331
331
  stage: pypi
332
332
  tags:
333
333
  - hydroqc
334
- image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:049f7935029b57bdb18554561581fde63e454fc51be38b89214ff8dc9de35db0
334
+ image: registry.gitlab.com/hydroqc/hydroqc-base-container/3.11@sha256:c2f84259e74c1bbd73497ee0d5a71fb5d8f8ff68befdd90f2f5e9b282da0f709
335
335
  script:
336
336
  # TODO: try to pull the good package from gitlab pypi repo
337
337
  # then change the version (promote)
@@ -16,7 +16,7 @@ repos:
16
16
  - id: check-ast
17
17
 
18
18
  - repo: https://github.com/psf/black
19
- rev: 23.10.1
19
+ rev: 23.12.0
20
20
  hooks:
21
21
  - id: black
22
22
  language_version: python3
@@ -28,7 +28,7 @@ repos:
28
28
  additional_dependencies: [flake8-docstrings]
29
29
 
30
30
  - repo: https://github.com/PyCQA/isort
31
- rev: 5.12.0
31
+ rev: 5.13.2
32
32
  hooks:
33
33
  - id: isort
34
34
  args: ["--profile", "black", "--filter-files"]
@@ -40,7 +40,7 @@ repos:
40
40
  - id: doc8
41
41
 
42
42
  - repo: https://github.com/pre-commit/mirrors-mypy
43
- rev: v1.6.1
43
+ rev: v1.7.1
44
44
  hooks:
45
45
  - id: mypy
46
46
  args: [--strict, --pretty, --show-error-codes]
@@ -49,5 +49,6 @@ repos:
49
49
  - "types-PyYAML==6.0.12.12"
50
50
  - "types-python-dateutil==2.8.19.14"
51
51
  - "pytest-stub==1.1.0"
52
- - "aiohttp==3.8.6"
52
+ - "aiohttp==3.9.1"
53
53
  - "aiocache==0.12.2"
54
+ - "pkce==1.0.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Hydro-Quebec-API-Wrapper
3
- Version: 3.1.1
3
+ Version: 3.1.2
4
4
  Summary: A wrapper library to access hydro quebec API and more
5
5
  Home-page: https://hydroqc.ca
6
6
  Author-email: Hydroqc Team <info@hydroqc.ca>
@@ -1,4 +1,4 @@
1
- aiohttp==3.8.5
1
+ aiohttp==3.9.1
2
2
  python-dateutil==2.8.2
3
3
  pytz==2023.3.post1
4
4
  aiocache==0.12.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Hydro-Quebec-API-Wrapper
3
- Version: 3.1.1
3
+ Version: 3.1.2
4
4
  Summary: A wrapper library to access hydro quebec API and more
5
5
  Home-page: https://hydroqc.ca
6
6
  Author-email: Hydroqc Team <info@hydroqc.ca>
@@ -0,0 +1 @@
1
+ mqtt-hass-base==4.2.5
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  import asyncio
3
3
  import os
4
+ from datetime import date
4
5
 
5
6
  from hydroqc.webuser import WebUser
6
7
 
8
+
7
9
  USERNAME = os.getenv("hydroQcUsername")
8
10
  PASSWORD = os.getenv("hydroQcPassword")
9
11
 
@@ -32,28 +34,28 @@ async def async_func():
32
34
  print(data)
33
35
 
34
36
  # Can still access events but probably unnecessary
35
- await contract.winter_credit.refresh_data()
36
- data = contract.winter_credit.next_anchor
37
+ await contract.peak_handler.refresh_data()
38
+ data = contract.peak_handler.next_anchor
37
39
  print(data)
38
- data = contract.winter_credit.next_peak
40
+ data = contract.peak_handler.next_peak
39
41
  print(data)
40
- data = contract.winter_credit.next_peak_is_critical
42
+ data = contract.peak_handler.next_peak_is_critical
41
43
  print(data)
42
- data = contract.winter_credit.cumulated_credit
44
+ data = contract.peak_handler.cumulated_credit
43
45
  print(data)
44
46
 
45
47
  # Need to call refresh_data before accessing attributes
46
- await contract.winter_credit.refresh_data()
47
- wc = contract.winter_credit.__dict__
48
+ await contract.peak_handler.refresh_data()
49
+ wc = contract.peak_handler.__dict__
48
50
  for k in wc.keys():
49
51
  if not k.startswith("value_"):
50
52
  continue
51
53
  else:
52
54
  print(k + " : " + str(wc[k]))
53
55
  # Still accessible through the data property
54
- data = contract.winter_credit.raw_data
56
+ data = contract.peak_handler.raw_data
55
57
  print(data)
56
- data = await contract.get_hourly_consumption("2022-01-20")
58
+ data = await contract.get_hourly_consumption(date.fromisoformat("2022-01-20"))
57
59
  print(data)
58
60
  data = await contract.get_today_hourly_consumption()
59
61
  print(data)
@@ -63,7 +65,7 @@ async def async_func():
63
65
  print(data)
64
66
  data = await contract.get_annual_consumption()
65
67
  print(data)
66
- data = await contract.get_daily_consumption("2022-01-10", "2022-01-20")
68
+ data = await contract.get_daily_consumption(date.fromisoformat("2022-01-10"), date.fromisoformat("2022-01-20"))
67
69
  print(data)
68
70
 
69
71
 
@@ -3,7 +3,7 @@ url = https://hydroqc.ca
3
3
 
4
4
  [options]
5
5
  install_requires =
6
- aiohttp==3.8.5
6
+ aiohttp==3.9.1
7
7
  python-dateutil==2.8.2
8
8
  pytz==2023.3.post1
9
9
  aiocache==0.12.2
@@ -1,14 +1,14 @@
1
1
  flake8==6.1.0
2
2
  pydocstyle==6.3.0
3
3
  parameterized==0.9.0
4
- pylint==3.0.2
4
+ pylint==3.0.3
5
5
  pytest==7.4.3
6
6
  pytest-cov==4.1.0
7
- pytest-asyncio==0.21.1
8
- black==23.10.1
9
- mypy==1.6.1
7
+ pytest-asyncio==0.23.2
8
+ black==23.12.0
9
+ mypy==1.7.1
10
10
  types-pytz==2023.3.1.1
11
11
  types-PyYAML==6.0.12.12
12
12
  types-python-dateutil==2.8.19.14
13
- pyright==1.1.334
13
+ pyright==1.1.341
14
14
  lxml==4.9.3
@@ -15,7 +15,7 @@ from hydroqc.contract.common import (
15
15
  )
16
16
  from hydroqc.contract.contract_dpc import check_dpc_data_present
17
17
  from hydroqc.customer import Customer
18
- from hydroqc.error import HydroQcError
18
+ from hydroqc.error import HydroQcError, HydroQcHTTPError
19
19
  from hydroqc.peak.cpc.handler import CPCPeakHandler
20
20
  from hydroqc.webuser import WebUser
21
21
 
@@ -255,12 +255,35 @@ class SubTestCommon:
255
255
  @pytest.mark.asyncio
256
256
  async def test_hourly_consumption(self, contract: Contract) -> None:
257
257
  """Test hourly consumption stats."""
258
- today_hourly_consumption = await contract.get_today_hourly_consumption()
259
- assert today_hourly_consumption.get("success") is True
260
- assert today_hourly_consumption.get("results", {}).get("dateJour") in (
261
- today_str,
262
- yesterday_str,
263
- )
258
+ try:
259
+ today_hourly_consumption = await contract.get_today_hourly_consumption()
260
+ assert today_hourly_consumption.get("success") is True
261
+ assert today_hourly_consumption.get("results", {}).get("dateJour") in (
262
+ today_str,
263
+ yesterday_str,
264
+ )
265
+ except HydroQcHTTPError as exp:
266
+ # Failing at the end of the period
267
+ # So we are check if it's the case
268
+ # If not, it's an actual issue
269
+ await contract.get_periods_info()
270
+ if (
271
+ isinstance(contract.cp_current_day, int)
272
+ and isinstance(contract.cp_duration, int)
273
+ and (
274
+ contract.cp_current_day < 2
275
+ or contract.cp_duration - contract.cp_current_day < 2
276
+ )
277
+ ):
278
+ # end of period or new period detected
279
+ assert (
280
+ True
281
+ ), "End of period or new period detected: no hourly consumption"
282
+ else:
283
+ assert (
284
+ False
285
+ ), "NO End of period or new period detected: error in no hourly consumption"
286
+ raise exp
264
287
 
265
288
  @pytest.mark.asyncio
266
289
  async def test_total_hourly_consumption(self, contract: Contract) -> None:
@@ -338,12 +361,23 @@ class SubTestCommon:
338
361
  @pytest.mark.asyncio
339
362
  async def test_latest_period(self, contract: Contract) -> None:
340
363
  """Test latest_period."""
341
- assert (
342
- contract.cp_current_day is None
343
- ), "Method get_period_info is already called but it should not"
344
- assert (
345
- not contract.latest_period_info
346
- ), "Method get_period_info is already called but it should not"
364
+ if (
365
+ isinstance(contract.cp_current_day, int)
366
+ and isinstance(contract.cp_duration, int)
367
+ and (
368
+ contract.cp_current_day < 2
369
+ or contract.cp_duration - contract.cp_current_day < 2
370
+ )
371
+ ):
372
+ assert contract.cp_current_day is not None
373
+ assert contract.latest_period_info
374
+ else:
375
+ assert (
376
+ contract.cp_current_day is None
377
+ ), "Method get_period_info is already called but it should not"
378
+ assert (
379
+ not contract.latest_period_info
380
+ ), "Method get_period_info is already called but it should not"
347
381
 
348
382
  @typing.no_type_check
349
383
  @pytest.mark.asyncio
@@ -1,4 +1,6 @@
1
1
  """Contract DT tests module."""
2
+ from types import NoneType
3
+
2
4
  import pytest
3
5
 
4
6
  from hydroqc.contract import ContractDT
@@ -16,35 +18,51 @@ class SubTestContractDT:
16
18
  assert contract.rate == "DT"
17
19
  assert contract.rate_option == ""
18
20
 
19
- assert (
20
- isinstance(contract.cp_current_bill, float)
21
- and contract.cp_current_bill >= 0
22
- )
23
- assert (
24
- isinstance(contract.cp_projected_bill, float)
25
- and contract.cp_projected_bill >= 0
26
- )
27
- assert (
28
- isinstance(contract.cp_daily_bill_mean, float)
29
- and contract.cp_daily_bill_mean >= 0
30
- )
31
- assert (
32
- isinstance(contract.cp_projected_total_consumption, int)
33
- and contract.cp_projected_total_consumption >= 0
34
- )
35
- assert (
36
- isinstance(contract.cp_kwh_cost_mean, float)
37
- and contract.cp_kwh_cost_mean >= 0
38
- )
21
+ if (
22
+ isinstance(contract.cp_current_day, int)
23
+ and isinstance(contract.cp_duration, int)
24
+ and (
25
+ contract.cp_current_day < 2
26
+ or contract.cp_duration - contract.cp_current_day < 2
27
+ )
28
+ ):
29
+ assert isinstance(contract.cp_current_bill, (float, NoneType))
30
+ assert isinstance(contract.cp_projected_bill, (float, NoneType))
31
+ assert isinstance(contract.cp_daily_bill_mean, (float, NoneType))
32
+ assert isinstance(contract.cp_projected_total_consumption, (int, NoneType))
33
+ assert isinstance(contract.cp_kwh_cost_mean, (float, NoneType))
34
+ assert isinstance(contract.cp_lower_price_consumption, (int, NoneType))
35
+ assert isinstance(contract.cp_higher_price_consumption, (int, NoneType))
36
+ else:
37
+ assert (
38
+ isinstance(contract.cp_current_bill, float)
39
+ and contract.cp_current_bill >= 0
40
+ )
41
+ assert (
42
+ isinstance(contract.cp_projected_bill, float)
43
+ and contract.cp_projected_bill >= 0
44
+ )
45
+ assert (
46
+ isinstance(contract.cp_daily_bill_mean, float)
47
+ and contract.cp_daily_bill_mean >= 0
48
+ )
49
+ assert (
50
+ isinstance(contract.cp_projected_total_consumption, int)
51
+ and contract.cp_projected_total_consumption >= 0
52
+ )
53
+ assert (
54
+ isinstance(contract.cp_kwh_cost_mean, float)
55
+ and contract.cp_kwh_cost_mean >= 0
56
+ )
39
57
 
40
- assert (
41
- isinstance(contract.cp_lower_price_consumption, int)
42
- and contract.cp_lower_price_consumption >= 0
43
- )
44
- assert (
45
- isinstance(contract.cp_higher_price_consumption, int)
46
- and contract.cp_higher_price_consumption >= 0
47
- )
58
+ assert (
59
+ isinstance(contract.cp_lower_price_consumption, int)
60
+ and contract.cp_lower_price_consumption >= 0
61
+ )
62
+ assert (
63
+ isinstance(contract.cp_higher_price_consumption, int)
64
+ and contract.cp_higher_price_consumption >= 0
65
+ )
48
66
 
49
67
  assert isinstance(contract.amount_saved_vs_base_rate, float)
50
68
 
@@ -1 +0,0 @@
1
- mqtt-hass-base==4.2.3