Urllib3: Broken import for HTTPHeaderDict in 1.26.0

Created on 11 Nov 2020  路  5Comments  路  Source: urllib3/urllib3

Subject

Responses has historically used from urllib3.connection import HTTPHeaderDict but that import is now failing in 1.26.0. Looking through the history this was changed as part of #2018

This change wasn't in the release notes and seems like an accidental regression. Is there a more stable package we should be importing HTTPHeaderDict from?

Environment

Describe your environment.

  • Using responses and urllib>=1.25.10

Steps to Reproduce

from urllib3.connection import HTTPHeaderDict

Expected Behavior

This import has worked for at least the past year.

Actual Behavior

An import error is raised.

Refs getsentry/responses#354

Most helpful comment

I've opened https://github.com/urllib3/urllib3/pull/2046 against 1.26 to relieve your users pain over this issue, however this import will not work in v2.

All 5 comments

Is there a more stable package we should be importing HTTPHeaderDict from?

This passive aggressive tact is unnecessary.

HTTPHeaderDict isn't supposed to be a public class (hence being defined in _collections). The import of HTTPHeaderDict in urllib3.response is likely more stable but there aren't any guarantees there either.

I've opened https://github.com/urllib3/urllib3/pull/2046 against 1.26 to relieve your users pain over this issue, however this import will not work in v2.

Will be released in v1.26.1

This passive aggressive tact is unnecessary.

I'm sorry. That was not my intent, I will try to be more direct in the future.

... however this import will not work in v2.
@sethmlarson In responses, we use this class when creating stubbed HTTP responses as it makes handling cookies easier. Will there be a different path to achieve that?

Was this page helpful?
0 / 5 - 0 ratings