Hydro-Quebec-API-Wrapper 4.2.2__tar.gz → 4.2.4__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 (104) hide show
  1. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.pre-commit-config.yaml +1 -1
  2. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/Hydro_Quebec_API_Wrapper.egg-info/PKG-INFO +1 -1
  3. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/PKG-INFO +1 -1
  4. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_dpc.py +21 -23
  5. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/hydro_api/client.py +24 -20
  6. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/test_requirements.txt +1 -1
  7. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.coveragerc +0 -0
  8. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.devcontainer/Dockerfile +0 -0
  9. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.devcontainer/devcontainer.json +0 -0
  10. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.flake8 +0 -0
  11. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.gitignore +0 -0
  12. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.gitlab-ci.yml +0 -0
  13. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/.pylintrc +0 -0
  14. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/Hydro_Quebec_API_Wrapper.egg-info/SOURCES.txt +0 -0
  15. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/Hydro_Quebec_API_Wrapper.egg-info/dependency_links.txt +0 -0
  16. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/Hydro_Quebec_API_Wrapper.egg-info/entry_points.txt +0 -0
  17. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/Hydro_Quebec_API_Wrapper.egg-info/requires.txt +0 -0
  18. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/Hydro_Quebec_API_Wrapper.egg-info/top_level.txt +0 -0
  19. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/LICENSE +0 -0
  20. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/MANIFEST.in +0 -0
  21. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/README.md +0 -0
  22. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/config.default.yaml +0 -0
  23. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/conflict_test_requirements.txt +0 -0
  24. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/Makefile +0 -0
  25. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/make.bat +0 -0
  26. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/_static/custom.css +0 -0
  27. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/_static/hydroqc-logo-128.png +0 -0
  28. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/_static/hydroqc-logo.svg +0 -0
  29. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/conf.py +0 -0
  30. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/external/description-des-codes-interruption.pdf +0 -0
  31. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/index.rst +0 -0
  32. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.contract.rst +0 -0
  33. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.hydro_api.rst +0 -0
  34. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.peak.cpc.rst +0 -0
  35. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.peak.dpc.rst +0 -0
  36. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.peak.rst +0 -0
  37. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.rst +0 -0
  38. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/hydroqc.types.rst +0 -0
  39. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/reference/modules.rst +0 -0
  40. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/docs/source/todo.rst +0 -0
  41. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/examples/hydro.py +0 -0
  42. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/__init__.py +0 -0
  43. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/account.py +0 -0
  44. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/consts.py +0 -0
  45. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/__init__.py +0 -0
  46. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/common.py +0 -0
  47. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_d.py +0 -0
  48. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_d_cpc.py +0 -0
  49. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_dt.py +0 -0
  50. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_m.py +0 -0
  51. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_m_gdp.py +0 -0
  52. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/contract_residential.py +0 -0
  53. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/contract/outage.py +0 -0
  54. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/customer.py +0 -0
  55. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/diagnostic.py +0 -0
  56. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/error.py +0 -0
  57. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/hydro_api/__init__.py +0 -0
  58. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/hydro_api/cache.py +0 -0
  59. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/hydro_api/consts.py +0 -0
  60. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/logger.py +0 -0
  61. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/__init__.py +0 -0
  62. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/basepeak.py +0 -0
  63. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/basepeakhandler.py +0 -0
  64. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/consts.py +0 -0
  65. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/cpc/__init__.py +0 -0
  66. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/cpc/consts.py +0 -0
  67. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/cpc/handler.py +0 -0
  68. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/cpc/peak.py +0 -0
  69. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/dpc/__init__.py +0 -0
  70. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/dpc/consts.py +0 -0
  71. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/dpc/handler.py +0 -0
  72. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/peak/dpc/peak.py +0 -0
  73. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/public_client.py +0 -0
  74. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/py.typed +0 -0
  75. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/timerange.py +0 -0
  76. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/__init__.py +0 -0
  77. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/account.py +0 -0
  78. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/common.py +0 -0
  79. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/consump.py +0 -0
  80. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/contract.py +0 -0
  81. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/cpc.py +0 -0
  82. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/dpc.py +0 -0
  83. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/dt.py +0 -0
  84. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/types/outage.py +0 -0
  85. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/utils.py +0 -0
  86. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/hydroqc/webuser.py +0 -0
  87. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/logo/hydroqc-logo-128.png +0 -0
  88. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/logo/hydroqc-logo.svg +0 -0
  89. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/pyproject.toml +0 -0
  90. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/renovate.json5 +0 -0
  91. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/setup.cfg +0 -0
  92. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/__init__.py +0 -0
  93. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/conftest.py +0 -0
  94. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_common.py +0 -0
  95. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_contract_d.py +0 -0
  96. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_contract_d_cpc.py +0 -0
  97. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_contract_dpc.py +0 -0
  98. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_contract_dt.py +0 -0
  99. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_contract_m.py +0 -0
  100. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/subtest_contract_m_gdp.py +0 -0
  101. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/test_basic.py +0 -0
  102. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/test_timerange.py +0 -0
  103. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tests/tools.py +0 -0
  104. {hydro_quebec_api_wrapper-4.2.2 → hydro_quebec_api_wrapper-4.2.4}/tox.ini +0 -0
@@ -40,7 +40,7 @@ repos:
40
40
  - id: doc8
41
41
 
42
42
  - repo: https://github.com/pre-commit/mirrors-mypy
43
- rev: v1.18.2
43
+ rev: v1.19.0
44
44
  hooks:
45
45
  - id: mypy
46
46
  args: [--strict, --pretty, --show-error-codes]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Hydro-Quebec-API-Wrapper
3
- Version: 4.2.2
3
+ Version: 4.2.4
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Hydro-Quebec-API-Wrapper
3
- Version: 4.2.2
3
+ Version: 4.2.4
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>
@@ -21,7 +21,10 @@ class WinterState(str, Enum):
21
21
  def check_dpc_data_present(
22
22
  method: Callable[..., None | str | bool | float | int | date | WinterState],
23
23
  ) -> Callable[..., None | str | bool | float | int | date | WinterState]:
24
- """Check if contractDPC's data are present."""
24
+ """Check if contractDPC's data are present.
25
+
26
+ Returns None if data is not available or incomplete.
27
+ """
25
28
 
26
29
  def wrapper(
27
30
  contract: "ContractDPC",
@@ -110,19 +113,6 @@ class ContractDPC(ContractResidential):
110
113
  )
111
114
  return self._dpc_data
112
115
 
113
- def _get_dpc_field(self, field_name: str) -> str | float | int:
114
- """Get DPC field from periodesHiver data.
115
-
116
- Raises:
117
- KeyError: If the required field is not present in the API response.
118
- """
119
- winter_period = self._dpc_data["periodesHiver"][0]
120
- if field_name not in winter_period:
121
- raise KeyError(
122
- f"Required field '{field_name}' not found in DPC periodesHiver data"
123
- )
124
- return winter_period[field_name] # type: ignore
125
-
126
116
  @property
127
117
  @check_period_data_present
128
118
  def cp_lower_price_consumption(self) -> float:
@@ -148,7 +138,7 @@ class ContractDPC(ContractResidential):
148
138
  @check_dpc_data_present
149
139
  def last_update_date(self) -> date:
150
140
  """DPC data last update."""
151
- date_str = str(self._get_dpc_field("dateMaj"))
141
+ date_str = str(self._dpc_data["periodesHiver"][0]["dateMaj"])
152
142
  # Handle ISO format with timezone
153
143
  if "T" in date_str:
154
144
  return date.fromisoformat(date_str.split("T", maxsplit=1)[0])
@@ -157,14 +147,17 @@ class ContractDPC(ContractResidential):
157
147
  @property
158
148
  @check_dpc_data_present
159
149
  def critical_called_hours(self) -> int:
160
- """Get number of critical hours."""
161
- return int(self._get_dpc_field("hrsCritiquesAppelees"))
150
+ """Get number of critical hours.
151
+
152
+ Returns 0 for current ongoing winter period where hours haven't been called yet.
153
+ """
154
+ return int(self._dpc_data["periodesHiver"][0].get("hrsCritiquesAppelees", 0))
162
155
 
163
156
  @property
164
157
  @check_dpc_data_present
165
158
  def max_critical_called_hours(self) -> int:
166
159
  """Get max number of critical hours."""
167
- return int(self._get_dpc_field("hrsCritiquesAppeleesMax"))
160
+ return int(self._dpc_data["periodesHiver"][0]["hrsCritiquesAppeleesMax"])
168
161
 
169
162
  @property
170
163
  @check_dpc_data_present
@@ -173,10 +166,12 @@ class ContractDPC(ContractResidential):
173
166
 
174
167
  Returns None if comparison data is not yet available (e.g., first year on Flex D).
175
168
  """
176
- try:
177
- return float(self._get_dpc_field("montantEconPerteVSTarifBase"))
178
- except KeyError:
169
+ if (
170
+ self._dpc_data["periodesHiver"][0].get("montantEconPerteVSTarifBase")
171
+ is None
172
+ ):
179
173
  return None
174
+ return float(self._dpc_data["periodesHiver"][0]["montantEconPerteVSTarifBase"])
180
175
 
181
176
  @property
182
177
  @check_dpc_data_present
@@ -190,11 +185,14 @@ class ContractDPC(ContractResidential):
190
185
  @property
191
186
  @check_dpc_data_present
192
187
  def winter_total_days_last_update(self) -> int:
193
- """Get number of days since winter starts (calculated from dates)."""
188
+ """Get number of days since winter starts (calculated from dates).
189
+
190
+ Returns 0 if last update is before winter start (pre-season setup).
191
+ """
194
192
  winter = self._dpc_data["periodesHiver"][0]
195
193
  start = datetime.fromisoformat(winter["dateDebut"].replace("Z", "+00:00"))
196
194
  update = datetime.fromisoformat(winter["dateMaj"].replace("Z", "+00:00"))
197
- return (update - start).days
195
+ return max(0, (update - start).days)
198
196
 
199
197
  @property
200
198
  @check_dpc_data_present
@@ -1,5 +1,6 @@
1
1
  """HydroQc Client Module."""
2
2
 
3
+ import asyncio
3
4
  import base64
4
5
  import csv
5
6
  import json
@@ -7,7 +8,6 @@ import logging
7
8
  import os
8
9
  import platform
9
10
  import re
10
- import ssl
11
11
  import uuid
12
12
  from collections.abc import Iterator
13
13
  from datetime import date, datetime, timedelta
@@ -114,6 +114,8 @@ class HydroClient:
114
114
  self.guid: str = str(uuid.uuid1())
115
115
  self._logger: logging.Logger = get_logger("httpclient", log_level)
116
116
  self._logger.debug("HydroQc initialized")
117
+ # Cache for blocking operations (initialized lazily)
118
+ self._cached_version: str | None = None
117
119
  self.reset()
118
120
 
119
121
  def reset(self) -> None:
@@ -128,20 +130,27 @@ class HydroClient:
128
130
  self._selected_customer = ""
129
131
  self._selected_contract = ""
130
132
 
131
- @property
132
- def user_agent(self) -> str:
133
+ async def _get_user_agent(self) -> str:
133
134
  """Get http client user_agent."""
134
- try:
135
- hydroqc_version = version("Hydro_Quebec_API_Wrapper")
136
- except PackageNotFoundError:
137
- # package is not installed
138
- self._logger.warning(
139
- "Python package `Hydro_Quebec_API_Wrapper` is not installed. "
140
- "Install it using pip"
141
- )
142
- hydroqc_version = "unkwown"
135
+ if self._cached_version is None:
136
+ # Run blocking version lookup in executor to avoid blocking event loop
137
+ loop = asyncio.get_event_loop()
138
+ try:
139
+ self._cached_version = await loop.run_in_executor(
140
+ None, version, "Hydro_Quebec_API_Wrapper"
141
+ )
142
+ except PackageNotFoundError:
143
+ # package is not installed
144
+ self._logger.warning(
145
+ "Python package `Hydro_Quebec_API_Wrapper` is not installed. "
146
+ "Install it using pip"
147
+ )
148
+ self._cached_version = "unkwown"
143
149
  os_name = platform.system()
144
- return f"Hydroqc/{hydroqc_version} (dev@hydroqc.ca; https://gitlab.com/hydroqc) {os_name}"
150
+ return (
151
+ f"Hydroqc/{self._cached_version} "
152
+ f"(dev@hydroqc.ca; https://gitlab.com/hydroqc) {os_name}"
153
+ )
145
154
 
146
155
  async def http_request(
147
156
  self,
@@ -163,15 +172,10 @@ class HydroClient:
163
172
  data = {}
164
173
  if headers is None:
165
174
  headers = {}
166
- headers["User-Agent"] = self.user_agent
175
+ headers["User-Agent"] = await self._get_user_agent()
167
176
  if verify_ssl is None:
168
177
  verify_ssl = self._verify_ssl
169
178
 
170
- ssl_context: ssl.SSLContext | None = None
171
- if verify_ssl:
172
- ssl_context = ssl.create_default_context()
173
- ssl_context.set_ciphers("DEFAULT") # Needed for python3.10
174
-
175
179
  # Query Diagnostic
176
180
  if self._diag_folder is not None:
177
181
  cleaned_url = url.replace("/", "_").replace(":", "").split("#", 1)[0]
@@ -205,7 +209,7 @@ class HydroClient:
205
209
  params=params,
206
210
  data=data,
207
211
  allow_redirects=allow_redirects,
208
- ssl=ssl_context,
212
+ ssl=verify_ssl,
209
213
  headers=headers,
210
214
  )
211
215
 
@@ -6,7 +6,7 @@ pytest==9.0.1
6
6
  pytest-cov==7.0.0
7
7
  pytest-asyncio==1.3.0
8
8
  black==25.11.0
9
- mypy==1.18.2
9
+ mypy==1.19.0
10
10
  types-pytz==2025.2.0.20251108
11
11
  types-PyYAML==6.0.12.20250915
12
12
  types-python-dateutil==2.9.0.20251115