eero-api 8.4.1__tar.gz → 8.4.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 (65) hide show
  1. {eero_api-8.4.1/src/eero_api.egg-info → eero_api-8.4.2}/PKG-INFO +1 -1
  2. {eero_api-8.4.1 → eero_api-8.4.2}/pyproject.toml +2 -2
  3. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/__init__.py +1 -1
  4. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/client.py +99 -3
  5. {eero_api-8.4.1 → eero_api-8.4.2/src/eero_api.egg-info}/PKG-INFO +1 -1
  6. {eero_api-8.4.1 → eero_api-8.4.2}/LICENSE +0 -0
  7. {eero_api-8.4.1 → eero_api-8.4.2}/README.md +0 -0
  8. {eero_api-8.4.1 → eero_api-8.4.2}/setup.cfg +0 -0
  9. {eero_api-8.4.1 → eero_api-8.4.2}/setup.py +0 -0
  10. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/__init__.py +0 -0
  11. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/_params.py +0 -0
  12. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/_writes.py +0 -0
  13. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/ac_compat.py +0 -0
  14. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/account.py +0 -0
  15. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/auth.py +0 -0
  16. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/auth_storage.py +0 -0
  17. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/backup.py +0 -0
  18. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/backup_access_points.py +0 -0
  19. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/base.py +0 -0
  20. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/blacklist.py +0 -0
  21. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/burst_reporters.py +0 -0
  22. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/data_usage.py +0 -0
  23. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/ddns.py +0 -0
  24. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/devices.py +0 -0
  25. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/dhcp.py +0 -0
  26. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/diagnostics.py +0 -0
  27. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/dns.py +0 -0
  28. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/dns_policies.py +0 -0
  29. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/eeros.py +0 -0
  30. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/entitlements.py +0 -0
  31. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/events.py +0 -0
  32. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/forwards.py +0 -0
  33. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/insights.py +0 -0
  34. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/links.py +0 -0
  35. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/members.py +0 -0
  36. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/networks.py +0 -0
  37. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/notifications.py +0 -0
  38. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/ouicheck.py +0 -0
  39. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/permissions.py +0 -0
  40. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/power_saving.py +0 -0
  41. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/profiles.py +0 -0
  42. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/reservations.py +0 -0
  43. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/routing.py +0 -0
  44. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/schedule.py +0 -0
  45. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/security.py +0 -0
  46. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/sqm.py +0 -0
  47. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/subnets.py +0 -0
  48. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/support.py +0 -0
  49. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/thread.py +0 -0
  50. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/transfer.py +0 -0
  51. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/updates.py +0 -0
  52. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/wan.py +0 -0
  53. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/api/wpa3.py +0 -0
  54. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/const.py +0 -0
  55. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/errors.py +0 -0
  56. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/exceptions.py +0 -0
  57. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/logging.py +0 -0
  58. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero/py.typed +0 -0
  59. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero_api.egg-info/SOURCES.txt +0 -0
  60. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero_api.egg-info/dependency_links.txt +0 -0
  61. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero_api.egg-info/requires.txt +0 -0
  62. {eero_api-8.4.1 → eero_api-8.4.2}/src/eero_api.egg-info/top_level.txt +0 -0
  63. {eero_api-8.4.1 → eero_api-8.4.2}/tests/test_errors.py +0 -0
  64. {eero_api-8.4.1 → eero_api-8.4.2}/tests/test_exceptions.py +0 -0
  65. {eero_api-8.4.1 → eero_api-8.4.2}/tests/test_logging.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eero-api
3
- Version: 8.4.1
3
+ Version: 8.4.2
4
4
  Summary: Modern async Python client for Eero network management
5
5
  Author: Eero API Contributors
6
6
  Maintainer: Eero API Contributors
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eero-api"
7
- version = "8.4.1"
7
+ version = "8.4.2"
8
8
  description = "Modern async Python client for Eero network management"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -121,7 +121,7 @@ asyncio_mode = "auto"
121
121
 
122
122
  [tool.commitizen]
123
123
  name = "cz_conventional_commits"
124
- version = "8.4.1"
124
+ version = "8.4.2"
125
125
  version_files = [
126
126
  "pyproject.toml:project.version",
127
127
  "src/eero/__init__.py:__version__",
@@ -53,4 +53,4 @@ __all__ = [
53
53
  "redact_sensitive",
54
54
  ]
55
55
 
56
- __version__ = "8.4.1"
56
+ __version__ = "8.4.2"
@@ -9,7 +9,7 @@ import copy
9
9
  import logging
10
10
  import re
11
11
  import time
12
- from typing import Any, Dict, List, Mapping, Optional, Union
12
+ from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
13
13
 
14
14
  from aiohttp import ClientSession, ClientTimeout
15
15
 
@@ -617,6 +617,18 @@ class EeroClient:
617
617
  as the account having no networks. Only a successful fallback
618
618
  that finds no networks yields a cacheable empty result.
619
619
 
620
+ /networks lists only the networks the account owns. When it is
621
+ not empty, networks the account administers through eero
622
+ Multi-Admin (listed only on /account) are appended after the
623
+ owned networks, de-duplicated by network id. A fresh cached
624
+ /account response is reused rather than refetched, even when
625
+ ``refresh_cache`` is set. If /account cannot be read in this
626
+ path, the owned networks are returned but not cached, and any
627
+ older cached list is dropped, so the next call tries again.
628
+ When ``data.networks`` is the nested ``{"count": N, "data": [...]}``
629
+ container, admin networks are added to its inner list and the
630
+ container keeps its shape.
631
+
620
632
  Raises:
621
633
  EeroException: If the account fallback fails, e.g.
622
634
  ``EeroAuthenticationException`` or ``EeroRateLimitException``.
@@ -627,6 +639,9 @@ class EeroClient:
627
639
  return cached
628
640
 
629
641
  cache_epoch = self._cache_epoch
642
+ # The entry this read may supersede; _update_cache replaces the entry
643
+ # object, so identity tells whether another call stored a newer one.
644
+ superseded_entry = self._cache.get("networks")
630
645
  response = await self._api.networks.get_networks()
631
646
 
632
647
  # Check if response has networks
@@ -637,6 +652,7 @@ class EeroClient:
637
652
  elif isinstance(data, dict):
638
653
  networks = data.get("networks") or data.get("data") or []
639
654
 
655
+ cacheable = True
640
656
  # If /networks returns empty, fall back to /account endpoint
641
657
  if not networks:
642
658
  _LOGGER.debug("Networks endpoint returned empty, falling back to account endpoint")
@@ -648,8 +664,22 @@ class EeroClient:
648
664
  "meta": response.get("meta", {}),
649
665
  "data": {"networks": networks},
650
666
  }
651
-
652
- self._update_cache("networks", None, response, epoch=cache_epoch)
667
+ else:
668
+ # /networks lists only networks the account owns; networks it
669
+ # administers through eero Multi-Admin appear only on /account.
670
+ response, cacheable = await self._merge_admin_networks(response, networks)
671
+
672
+ if cacheable:
673
+ self._update_cache("networks", None, response, epoch=cache_epoch)
674
+ elif self._cache.get("networks") is superseded_entry:
675
+ # This read could not consult /account, so its result may be
676
+ # incomplete. Drop the older entry it was meant to replace (for
677
+ # example when refresh_cache was set) so the next call retries
678
+ # /account; an entry another call stored meanwhile is left alone.
679
+ # Remove the entry rather than zeroing its timestamp: freshness is
680
+ # measured against time.monotonic(), which on a recently booted
681
+ # host can still be within the cache timeout of 0.
682
+ self._cache.pop("networks", None)
653
683
 
654
684
  # Set preferred network ID if not already set
655
685
  if not self._preferred_network_id:
@@ -694,6 +724,72 @@ class EeroClient:
694
724
  networks_data = networks_data.get("data")
695
725
  return networks_data if isinstance(networks_data, list) else []
696
726
 
727
+ @staticmethod
728
+ def _network_key(network: Any) -> Optional[str]:
729
+ """Identify a network entry by its ``id``, or the last segment of its ``url``."""
730
+ if not isinstance(network, dict):
731
+ return None
732
+ net_id = network.get("id")
733
+ if net_id is None and isinstance(network.get("url"), str):
734
+ net_id = network["url"].rstrip("/").split("/")[-1] or None
735
+ return str(net_id) if net_id is not None else None
736
+
737
+ async def _merge_admin_networks(
738
+ self, response: Dict[str, Any], networks: Union[List[Any], Dict[str, Any]]
739
+ ) -> Tuple[Dict[str, Any], bool]:
740
+ """Append networks listed on ``/account`` but missing from ``/networks``.
741
+
742
+ ``/networks`` returns only the networks the account owns. Networks the
743
+ account was invited to as an admin are listed only on ``/account``, so
744
+ without this they never appear. The owned networks keep their place at
745
+ the front, which leaves auto-selection of the preferred network as it
746
+ was. A fresh cached ``/account`` response is reused to stay within the
747
+ rate limit. If ``/account`` cannot be read, the ``/networks`` result
748
+ is returned unchanged rather than failing a read that succeeded, and
749
+ is flagged as not cacheable because it may be missing networks.
750
+
751
+ Args:
752
+ response: Raw, non-empty ``/networks`` response.
753
+ networks: The network listing extracted from ``response``: a list,
754
+ or the nested ``{"count": N, "data": [...]}`` container.
755
+
756
+ Returns:
757
+ A ``(response, cacheable)`` tuple: ``response`` with any
758
+ admin-only networks appended to its list, and whether it is
759
+ complete enough to cache. A nested container keeps its shape.
760
+ """
761
+ # data["networks"] may be the nested {"count": N, "data": [...]}
762
+ # container (see wiki/Raw-Response-Format.md); merge into its list.
763
+ container = networks if isinstance(networks, dict) else None
764
+ owned = container.get("data") if container is not None else networks
765
+ if not isinstance(owned, list):
766
+ return response, True
767
+
768
+ try:
769
+ account_response = await self.get_account()
770
+ except EeroException as exc:
771
+ _LOGGER.debug("Could not read /account to find admin networks: %s", exc)
772
+ return response, False
773
+
774
+ seen = {key for key in map(self._network_key, owned) if key is not None}
775
+ extra = []
776
+ for network in self._networks_from_account(account_response):
777
+ key = self._network_key(network)
778
+ if key is None or key in seen:
779
+ continue
780
+ seen.add(key)
781
+ extra.append(network)
782
+ if not extra:
783
+ return response, True
784
+
785
+ merged = owned + extra
786
+ listing = {**container, "data": merged} if container is not None else merged
787
+ data = response.get("data")
788
+ if isinstance(data, dict):
789
+ list_key = "networks" if data.get("networks") else "data"
790
+ return {**response, "data": {**data, list_key: listing}}, True
791
+ return {**response, "data": listing}, True
792
+
697
793
  async def get_network(
698
794
  self, network_id: Optional[str] = None, refresh_cache: bool = False
699
795
  ) -> Dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eero-api
3
- Version: 8.4.1
3
+ Version: 8.4.2
4
4
  Summary: Modern async Python client for Eero network management
5
5
  Author: Eero API Contributors
6
6
  Maintainer: Eero API Contributors
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes