Skip to content

[nodriver] Wrong set_all #2150

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

Open
boludoz opened this issue Mar 2, 2025 · 2 comments
Open

[nodriver] Wrong set_all #2150

boludoz opened this issue Mar 2, 2025 · 2 comments

Comments

@boludoz
Copy link

boludoz commented Mar 2, 2025

Fixed func.

async def set_all(cookies_handler, cookies: List[cdp.network.CookieParam]):
    """
    set cookies

    :param cookies: list of cookies
    :type cookies:
    :return:
    :rtype:
    """
    connection = None
    for tab in cookies_handler._browser.tabs:
        if tab.closed:
            continue
        connection = tab
        break
    else:
        connection = cookies_handler._browser.connection
    await connection.send(cdp.storage.set_cookies(cookies))

@boludoz
Copy link
Author

boludoz commented Mar 2, 2025

I have to update the fucking function manually in all my codes.

@joshuaseltzer
Copy link

@ultrafunkamsterdam would you consider pushing this fix? There are 2 open PRs (8 and 16) that address this issue and will fix it immediately once merged.

If I had to guess, the issue itself is a copy/paste mistake from the get_all function. The problem is fixed by simply removing line 785 in browser.py which is erroneously overriding the provided cookies with cookies already loaded into the browser which completely breaks the ability to set cookies.

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

No branches or pull requests

2 participants