Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Silent dependency on urllib3 in _aiohttp_requests #707

Closed

Description

@asafflesch

Environment details

  • OS: OSX, Linux
  • Python version: 3.7
  • pip version:
  • google-auth version: 1.24.0

Steps to reproduce

  1. Setup a clean virtualenv
  2. pip install google-auth==1.24.0 aiohttp==3.5.4 (version I happen to be using)
  3. Run "from google.auth.transport import _aiohttp_requests" in a python3 session

You should get a ModuleNotFoundError for "urllib3"

Activity

  1. asafflesch commented on Feb 17, 2021

    @asafflesch
    Author

    (I see there's also a silent dependency there on requests - maybe you just intend for the exception on requests not being installed to go off first?)

  2. busunkim96 commented on Feb 18, 2021

    @busunkim96
    Contributor

    Hey @FaQA,

    Before aiohttp_requests we didn't have urllib3 or requests as hard dependencies and assumed that folks would install one or both as needed after seeing one of these error messages:

    try:
    import requests
    except ImportError as caught_exc: # pragma: NO COVER
    import six
    six.raise_from(
    ImportError(
    "The requests library is not installed, please install the "
    "requests package to use the requests transport."
    ),
    caught_exc,

    try:
    import urllib3
    except ImportError as caught_exc: # pragma: NO COVER
    import six
    six.raise_from(
    ImportError(
    "The urllib3 library is not installed, please install the "
    "urllib3 package to use the urllib3 transport."
    ),
    caught_exc,
    )

    Since _aiohttp_requests has a hard dependency on both I think we should just add it to the aiohttp extra to reduce friction. I'll open a PR adjusting the extras. After that change if you do pip install google-auth[aiohttp] it should pull in all the required dependencies.

    extras = {
    "aiohttp": "aiohttp >= 3.6.2, < 4.0.0dev; python_version>='3.6'",
    "pyopenssl": "pyopenssl>=20.0.0",
    }

  3. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    and removed
    triage meI really want to be triaged.
    on Feb 18, 2021
  4. parthea commented on May 19, 2021

    @parthea
    Contributor

    @busunkim96 Please can you take a look?

  5. added a commit that references this issue on May 25, 2021
    a923442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions