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

The async AuthorizedSession doesn't support customized ClientSession parameters #1530

Closed
hongyiweiwu01 opened this issue Jun 4, 2024 · 0 comments · Fixed by #1533 · May be fixed by #1535
Closed

The async AuthorizedSession doesn't support customized ClientSession parameters #1530

hongyiweiwu01 opened this issue Jun 4, 2024 · 0 comments · Fixed by #1533 · May be fixed by #1535
Assignees

Comments

@hongyiweiwu01
Copy link

hongyiweiwu01 commented Jun 4, 2024

AuthorizedSession takes keyword arguments that are passed down to the ClientSession, so when we make requests using the session that it yields, these arguments are effective. However, AuthorizedSession also does token fresh in its request method, where it manually creates a ClientSession which doesn't include these keyword arguments.

In my scenario, we have to run some logic under a VPN, so I need to pass trust_env into every aiohttp Session, cause otherwise the request would just hang and eventually time out. Because of this I cannot really use AuthorizedSession as it just always times out at the token refresh step.

Environment details

  • OS: MacOS 14.3
  • Python version: 3.12
  • google-auth version: 2.29.0

Steps to reproduce

credentials, _ = default_async()
async with AuthorizedSession(trust_env=False) as session:
   await session.request(...)

The code is stuck at the session.request step until it times out if a proxy is used.

Possible solutions

We can just pass the kwargs accepted in the AuthorizedSession constructor into the ClientSession constructor here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants