Skip to content

PiHole6API v0.1.9 - Connection Handling Improvements

Choose a tag to compare

@sbarbett sbarbett released this 17 Apr 04:06
· 12 commits to main since this release

Release Notes

Connection Changes

  • Added retry support for failed requests using urllib3.Retry, including:
    • Configurable max_retries and retry_delay parameters with exponential backoff.
    • Retry conditions for HTTP 429, 500, 502, 503, and 504 status codes.
  • Introduced connection pooling options with disable_connection_pooling parameter.

Timeout Configuration

  • Added connection_timeout parameter (default: 10 seconds) to avoid indefinite hangs during network issues.

Improved Session Management

  • Configured a requests.Session() with custom HTTPAdapter for retry and pooling behavior.
  • self.session.timeout is now set globally based on the connection_timeout setting.

Logging Integration

  • Added a logger (logging.getLogger("pihole6api")) to provide debug and error output for:
    • Authentication attempts
    • Retry timing
    • Request errors and timeouts

Enhanced Error Handling

  • More detailed error messages extracted from API responses on failed authentication.
  • Graceful fallback when authentication fails repeatedly, raising the last encountered error.
  • Improved parsing of 4xx error responses.