Skip to content

urllib3 wrapper maintenance: dead kwargs + brittle import-time defaults #11

Description

@AndresL230

Summary

Two related urllib3-patch maintenance issues:

1. Dead kwargs

_interceptor.py:108 lists pool_connections and pool_maxsize as kwargs on the urlopen wrapper. Neither is an actual HTTPConnectionPool.urlopen parameter — they're PoolManager.__init__ parameters. The wrapper accepts and silently drops them.

2. Brittle import-time default

_interceptor.py:108 references urllib3.util.Timeout.DEFAULT_TIMEOUT as a default-argument value at function-definition time. If the installed urllib3 (or a future release) doesn't expose that attribute, the SDK fails to import — and the failure happens before any user code runs.

Fix

  • Remove the dead pool_connections / pool_maxsize params; rely entirely on **kwargs forwarding.
  • Use a sentinel (_DEFAULT = object()) for the timeout default; resolve to the urllib3 default inside the body. Wrap import-time lookups in a try/except so a broken urllib3 install degrades to a no-op rather than crashing the host app.

Files

  • recost/_interceptor.py
  • tests/test_interceptor.py

Priority

P2 — fragile across urllib3 releases; one renamed attribute could break SDK import for all users on the new urllib3.

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

    P2Polish / nice-to-havebugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions