fix: deprecate ActivityAPI + fix get_insights signature (closes #107)#113
fix: deprecate ActivityAPI + fix get_insights signature (closes #107)#113fulviofreitas wants to merge 2 commits into
Conversation
…arams
The Eero cloud API rejects GET /networks/{id}/insights without the four
query parameters `start`, `end`, `cadence`, and `insight_type` (returns
400 error.form.errors). The current SDK method sent none of them, so
every call silently 400'd — nobody was actually using this method
successfully.
New signature:
async def get_insights(
self,
network_id: str,
*,
start: str, # ISO 8601, e.g. "2026-07-21T00:00:00Z"
end: str, # ISO 8601
insight_type: str, # "adblock" | "blocked" | "inspected"
cadence: str = "daily", # "hourly" | "daily" | "weekly"
)
Only `cadence` gets an SDK-supplied default, since it controls display
bucketing rather than data scope. Response envelope is passed through
raw as always (v2.0 contract preserved).
Live-verified against a real account: returns the expected
`{series: [{insight_type, sum, values: [{time, value}]}]}` shape.
The `insight_type=blocked` variant returns seven series (blocked,
malware, botnet, phishing, parked, domains, compromised) — the
enum is broader in the response than in the request.
Breaking change to any caller of get_insights(network_id), but since
that call was already 100% broken (400), nothing usable regresses.
Follow-up cleanup filed for eero-prometheus-exporter and eeroctl.
Refs #107.
…ro API
Every /networks/{id}/activity* endpoint targeted by ActivityAPI now
returns 404. Live-verified on API versions 2.2 and 2.3, and against
the network's own resource map: the map lists `insights` but has NO
`activity` resource. Rename candidates (timeline, history, analytics,
traffic, events, clientusage) also all 404.
All five ActivityAPI methods (and their EeroClient wrappers) now
emit a DeprecationWarning pointing callers to:
- InsightsAPI.get_insights(...) — category / adblock / inspected
breakdowns
- DataUsageAPI.get_data_usage(...) — bandwidth per client / node
The existing implementations are retained (they'll continue to
raise EeroAPIException with a 404 as they do today) so nothing
regresses during the deprecation window. Scheduled for removal in
v6.0.0.
ACTIVITY_DEPRECATION_MSG is defined once in api/activity.py and
imported by client.py — single source of truth for the removal
target and issue URL, matching the pattern established for
PRIORITY_DEPRECATION_MSG.
Live-verified: DeprecationWarning fires on all five methods.
Closes #107. Follow-up migration issues filed in
eero-prometheus-exporter and eeroctl.
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #107.
Summary
ActivityAPI's five methods target/networks/{id}/activity*endpoints that no longer exist on Eero's cloud API — every call raises 404. Deprecate the whole surface (removal in v6.0.0) and point migrators toInsightsAPI.get_insightsandDataUsageAPI.get_data_usage.While probing the replacement endpoint I discovered
InsightsAPI.get_insights(network_id)was also 100% broken — the API requires four required query params (start,end,insight_type,cadence) that the SDK wasn't sending. Fixed the signature in the same PR so the migration target actually works.Live-established API facts
Probed against a real account, network 3401709:
GET /2.2/networks/{id}/activityGET /2.3/networks/{id}/activityGET /2.2/networks/{id}/activity/clientsGET /2.2/networks/{id}/activity/categoriesGET /2.2/networks/{id}/activity/history/timeline,/history,/analytics,/traffic,/clientusage,/activity/summary, etc.)insights, noactivityentryGET /2.2/networks/{id}/insights(no params)error.form.errors—start,end,cadence,insight_typeall requiredGET /2.2/networks/{id}/insights?start=…&end=…&cadence=daily&insight_type=adblockinsight_type=blockedresponseblocked, malware, botnet, phishing, parked, domains, compromisedChanges
src/eero/api/insights.py— new signature, keyword-onlyOnly
cadencegets an SDK default (bucketing = display concern, not data scope). Response envelope passed through raw — v2.0 contract preserved.src/eero/api/activity.py— 5 methods emitDeprecationWarningShared
ACTIVITY_DEPRECATION_MSGconstant, docstring migration pointers toget_insights/get_data_usage. Class docstring updated. Same pattern asPRIORITY_DEPRECATION_MSGfrom PR #112.src/eero/client.pyget_insightswrapper: new required kwargs mirrored.DeprecationWarning.ACTIVITY_DEPRECATION_MSGfromapi/activity.py.Tests
tests/api/test_insights.py: 4 new tests covering param forwarding,cadencedefault, raw pass-through, keyword-only enforcement.tests/api/test_activity.py: rewrote — every existing method call now wrapped inpytest.warns(DeprecationWarning, match=…); newTestActivityAPIDeprecationMessageclass asserts the shared message names both replacements + tracking issue.pytest tests/→ 482 passed (whole SDK unit suite).What this does NOT include (v2.0 contract enforcement)
get_activity→get_insightsadapter that reshapes the response. Would violate v2.0 "raw JSON pass-through". Callers migrate their own call sites.last_24h()/last_week()helpers for buildingstart/end. Those belong in downstream clients.start/end/insight_type. Those are data-scoping decisions the caller must make.Downstream impact — real work required
The following repos have callers that will break (or, in some cases, will finally start working) once this ships:
eero-prometheus-exporter— callsclient.get_activity,get_activity_clients,get_activity_categories, AND the now-fixedclient.get_insights. All were failing on every scrape; issue filed for migration.eeroctl— hascommands/activity.py. Similar migration needed; issue filed.eero-ui— no known callers, but worth grep-checking after merge.Follow-up issues linked in comments once filed.
Commits
23ed5ddfix(insights): make get_insights actually work — add required query params3af7b85refactor(activity): deprecate ActivityAPI — endpoints removed from Eero APINot squashing (per prior convention on PR #112) — each commit is scoped and reads clearly in
git blame.Live-probing, implementation, and verification done by me. Code review invited from you (@fulviofreitas); happy to bring in a
security-engineeragent for a second pass if you want the same treatment as PR #112.