Skip to content

Modify of the Accept header #145

@juhacz

Description

@juhacz

Is it possible to modify the Accept header sent by the browser? I need to modify the Accept header.

import asyncio
from ichrome import AsyncChromeDaemon

async def test():
    async with AsyncChromeDaemon() as cd:
        # create a new tab
        async with cd.connect_tab(index=None) as tab:
            await tab.set_headers({"Accept": "application/vnd.opbox-web.v2+json"})
            await tab.goto('https://httpbin.org/headers', timeout=5)
            print(await tab.html)


asyncio.run(test())

The above program does nothing when I change the line

await tab.set_headers({"Accept2": "application/vnd.opbox-web.v2+json"})

the Accept2 header is correctly addeded, strangely enough when I change the lines to

await tab.set_headers({"User-Agent": "application/vnd.opbox-web.v2+json"})

User Agent is changed, but this does not work in the case of the Accept header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions