Skip to content
New issue

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

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

Already on GitHub? # to your account

Session argument for aiohttp request object is ignored #700

Closed
greshilov opened this issue Feb 16, 2021 · 1 comment
Closed

Session argument for aiohttp request object is ignored #700

greshilov opened this issue Feb 16, 2021 · 1 comment
Labels
priority: p2 Moderately-important priority. 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

@greshilov
Copy link
Contributor

Environment details

  • OS: Linux
  • Python version: 3.9
  • pip version: 20.2.3
  • google-auth version: 1.26.1

Steps to reproduce

Consider the following example:

import asyncio

import aiohttp
from google.auth.transport._aiohttp_requests import Request


async def main():
    async with aiohttp.ClientSession() as session:
        req = Request(session)
        assert req.session == session

if __name__ == '__main__':
    asyncio.run(main())

This code will raise AssertionError, because the session argument is ignored in the Request object.

def __init__(self, session=None):
self.session = None

This may also cause runtime warnings about unclosed sessions when AuthorizedSession object is used.

greshilov added a commit to greshilov/google-auth-library-python that referenced this issue Feb 16, 2021
greshilov added a commit to greshilov/google-auth-library-python that referenced this issue Feb 16, 2021
@busunkim96 busunkim96 added priority: p2 Moderately-important priority. 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 Feb 17, 2021
greshilov added a commit to greshilov/google-auth-library-python that referenced this issue May 6, 2021
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels May 18, 2021
greshilov added a commit to greshilov/google-auth-library-python that referenced this issue Jun 2, 2021
arithmetic1728 added a commit that referenced this issue Jun 3, 2021
* fix: session object was never used in aiohttp request (#700)

* fixup! fix: session object was never used in aiohttp request (#700)

* fixup! fixup! fix: session object was never used in aiohttp request (#700)

Co-authored-by: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>
@greshilov
Copy link
Contributor Author

The issue is resolved in #701 and the fix is available for users since 1.30.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
priority: p2 Moderately-important priority. 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
Development

No branches or pull requests

3 participants