Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError in google.oauth2.id_token #1455

Closed
B3QL opened this issue Jan 18, 2024 · 1 comment · Fixed by #1456
Closed

ImportError in google.oauth2.id_token #1455

B3QL opened this issue Jan 18, 2024 · 1 comment · Fixed by #1456
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@B3QL
Copy link

B3QL commented Jan 18, 2024

Environment details

  • OS: Ubuntu 20.04.6 LTS
  • Python version: 3.11.7
  • pip version: 23.3.1
  • google-auth version: 2.26.2

Steps to reproduce

  1. Install google-auth
  2. Import google.oauth2.id_token module

Hi folks,
it looks like google.oauth2.id_token has an import time dependency of google.auth.transport.requests
https://github.com/googleapis/google-auth-library-python/blob/main/google/oauth2/id_token.py#L65

which requires a requests package
https://github.com/googleapis/google-auth-library-python/blob/main/google/auth/transport/requests.py#L25

that's not defined as a google-auth dependency.
https://github.com/googleapis/google-auth-library-python/blob/main/setup.py#L22

The call to google.auth.transport.requests is only made once in https://github.com/googleapis/google-auth-library-python/blob/main/google/oauth2/id_token.py#L285 so the possible solution will be to move the import to runtime.

@clundin25
Copy link
Contributor

Thank you for pointing this out. Yes the code is not following the existing pattern of a runtime import if a request object is not passed in.

@clundin25 clundin25 added priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 18, 2024
@clundin25 clundin25 self-assigned this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
2 participants