FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add request/response history tracking · Issue #8 · Nasawa/HAAPI · GitHub

Repository navigation

Add request/response history tracking #8

Open

Description

Feature Request

Track history of recent API calls (last 5-10 calls) for debugging and monitoring.

Problem

Currently, only the latest response is stored. Users can't easily see patterns in API behavior or review recent calls for troubleshooting.

Proposed Solution

Add a configurable history buffer (default: 5 calls):

  • Store last N calls with timestamps
  • Include request details (rendered templates)
  • Include response details (status, body)
  • Expose as sensor attribute or separate diagnostic entity

Benefits

  • Better debugging for intermittent issues
  • See patterns in API responses over time
  • Useful for development/testing
  • Can track when APIs started failing

Implementation Notes

# In HaapiApiCaller
self._history = []  # List of dicts
HISTORY_SIZE = 5

# After each call
self._history.append({
    "timestamp": datetime.now().isoformat(),
    "status_code": status,
    "response_body": body,
    "request_url": rendered_url,
    "error": error_msg if error else None,
})
self._history = self._history[-HISTORY_SIZE:]  # Keep last N

# In Response sensor
attrs["call_history"] = self._api_caller.history

Considerations

  • Could increase database size
  • May need size limits per history entry
  • Could be opt-in feature
  • Consider diagnostic sensor vs main sensor attribute

Priority: Lower Priority

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL