env-canada 0.11.3__py3-none-any.whl → 0.12.0__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.
env_canada/constants.py CHANGED
@@ -1 +1 @@
1
- USER_AGENT = "env_canada/0.11.3"
1
+ USER_AGENT = "env_canada/0.12.0"
env_canada/ec_weather.py CHANGED
@@ -37,7 +37,7 @@ ATTRIBUTION = {
37
37
  }
38
38
 
39
39
 
40
- __all__ = ["ECWeather", "ECWeatherUpdateFailed"]
40
+ __all__ = ["ECWeather", "ECWeatherUpdateFailed", "get_ec_sites_list"]
41
41
 
42
42
 
43
43
  @dataclass
@@ -279,6 +279,37 @@ async def get_ec_sites():
279
279
  return sites
280
280
 
281
281
 
282
+ async def get_ec_sites_list():
283
+ """
284
+ Get list of sites formatted for selection dropdowns.
285
+
286
+ Returns a list of dictionaries with the form:
287
+ {"label": "Toronto, ON", "value": "458"}
288
+ where the value is the last three digits of the site code.
289
+ """
290
+ LOG.debug("get_ec_sites_list() started")
291
+ sites_list = []
292
+
293
+ async with ClientSession(raise_for_status=True) as session:
294
+ response = await session.get(
295
+ SITE_LIST_URL, headers={"User-Agent": USER_AGENT}, timeout=CLIENT_TIMEOUT
296
+ )
297
+ sites_csv_string = await response.text()
298
+
299
+ sites_reader = csv.DictReader(sites_csv_string.splitlines()[1:])
300
+
301
+ for site in sites_reader:
302
+ if site["Province Codes"] != "HEF":
303
+ # Extract last 3 digits from site code (e.g., "s0000106" -> "106")
304
+ site_value = site["Codes"][5:]
305
+ # Create label with city name and province (e.g., "Toronto, ON")
306
+ label = f"{site['English Names']}, {site['Province Codes']}"
307
+ sites_list.append({"label": label, "value": site_value})
308
+
309
+ LOG.debug("get_ec_sites_list() done, retrieved %d sites", len(sites_list))
310
+ return sites_list
311
+
312
+
282
313
  def find_province_for_station(site_list, station_number):
283
314
  """Find the province code for a given station number."""
284
315
  for site in site_list:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: env_canada
3
- Version: 0.11.3
3
+ Version: 0.12.0
4
4
  Summary: A package to access meteorological data from Environment Canada
5
5
  Author-email: Michael Davie <michael.davie@gmail.com>
6
6
  Maintainer-email: Michael Davie <michael.davie@gmail.com>
@@ -1,7 +1,5 @@
1
- env_canada/10x20.pbm,sha256=ClKTs2WUmhUhTHAQzPuGwPTICGVBzCvos5l-vHRBE5M,2463
2
- env_canada/10x20.pil,sha256=Oki6-TD7b0xFtfm6vxCKsmpEpsZ5Jaia_0v_aDz8bfE,5143
3
1
  env_canada/__init__.py,sha256=EXzGEHwon-usFzLzuJeISKHlfJdV3DBa0_rR9b_XfvE,405
4
- env_canada/constants.py,sha256=C9mCx8dS26TjS-XcPBa5Lp1u-Inmjn4OJ8YadKGlreo,33
2
+ env_canada/constants.py,sha256=1OlE7zCUy4imLHpReP1va3SzbksbwGXFQNyQzwR9NCw,33
5
3
  env_canada/ec_aqhi.py,sha256=bmgzq__b8ecvPGR_PAlDBa4uyA6OTVllikBVYwOefRc,8106
6
4
  env_canada/ec_cache.py,sha256=zb3n79ul7hUTE0IohDfZbRBLY-siOHPjYzWldMbuPVk,798
7
5
  env_canada/ec_exc.py,sha256=SBJwzmLf94lTx7KYVLfQYrMXYNYUoIxeVXc-BLkuXoE,67
@@ -9,9 +7,9 @@ env_canada/ec_historical.py,sha256=qMr4RE6vfNiNa_zFolQ0PQGraok8bQtIVjs_o6sJKD4,1
9
7
  env_canada/ec_hydro.py,sha256=HxfUsx43A6KBPdzNQs1-204UVstMXAyrpyj8h2B8Hlc,4909
10
8
  env_canada/ec_map.py,sha256=HIyCZ8j9EbuLX3-YhvMKjYPiE2AH_behL6IaOXjXpaQ,15564
11
9
  env_canada/ec_radar.py,sha256=dKZqWJyb66R2EJzAy4K7pii7vPK9FxDKmuW9vA1ADbw,3330
12
- env_canada/ec_weather.py,sha256=IGmQ4rvilxclb76h9Gu44e91uEfzmNTHu9gg9V_OTSs,23447
13
- env_canada-0.11.3.dist-info/licenses/LICENSE,sha256=BkgGIGgy9sv-OsI7mRi9dIQ3Su0m4IbjpZlfxv8oBbM,1073
14
- env_canada-0.11.3.dist-info/METADATA,sha256=Mi-V9ltbxYiHuM-9covAq6H3lhAgDbORlxSh6nWYewk,13618
15
- env_canada-0.11.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- env_canada-0.11.3.dist-info/top_level.txt,sha256=fw7Pcl9ULBXYvqnAdyBdmwPXW8GSRFmhO0sLZWVfOCc,11
17
- env_canada-0.11.3.dist-info/RECORD,,
10
+ env_canada/ec_weather.py,sha256=VS25XdRhFiFnqd3IBemwoc8pXz29j7hyimmTKLxeoNo,24638
11
+ env_canada-0.12.0.dist-info/licenses/LICENSE,sha256=BkgGIGgy9sv-OsI7mRi9dIQ3Su0m4IbjpZlfxv8oBbM,1073
12
+ env_canada-0.12.0.dist-info/METADATA,sha256=33e5Bojm24UU2jY7-M7FVhZZS5PqlJaJx6HaNgmUIv4,13618
13
+ env_canada-0.12.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ env_canada-0.12.0.dist-info/top_level.txt,sha256=fw7Pcl9ULBXYvqnAdyBdmwPXW8GSRFmhO0sLZWVfOCc,11
15
+ env_canada-0.12.0.dist-info/RECORD,,
env_canada/10x20.pbm DELETED
Binary file
env_canada/10x20.pil DELETED
Binary file