{"id":16776759,"url":"https://github.com/n0tan3rd/chrome-remote-interface-py","last_synced_at":"2025-04-10T20:14:17.498Z","repository":{"id":56555832,"uuid":"135003214","full_name":"N0taN3rd/chrome-remote-interface-py","owner":"N0taN3rd","description":"Chrome Debugging Protocol interface for python asyncio","archived":false,"fork":false,"pushed_at":"2020-10-31T19:41:49.000Z","size":1805,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T17:55:16.114Z","etag":null,"topics":["cdp","chrome-debugging-protocol","chrome-remote-interface","google-chrome","headless"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/N0taN3rd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-27T00:09:23.000Z","updated_at":"2025-02-27T07:39:05.000Z","dependencies_parsed_at":"2022-08-15T20:50:47.107Z","dependency_job_id":null,"html_url":"https://github.com/N0taN3rd/chrome-remote-interface-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/N0taN3rd%2Fchrome-remote-interface-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/N0taN3rd%2Fchrome-remote-interface-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/N0taN3rd%2Fchrome-remote-interface-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/N0taN3rd%2Fchrome-remote-interface-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/N0taN3rd","download_url":"https://codeload.github.com/N0taN3rd/chrome-remote-interface-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288369,"owners_count":21078903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdp","chrome-debugging-protocol","chrome-remote-interface","google-chrome","headless"],"created_at":"2024-10-13T07:10:52.609Z","updated_at":"2025-04-10T20:14:17.478Z","avatar_url":"https://github.com/N0taN3rd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"CRIPY\n=========\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nChrome Remote Interface Python or cripy for short is an unofficial port of [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface) by [@cyrus-and](https://github.com/cyrus-and).\nPython 3.5+ only.\n\nSample Usage\n----------------\n\n```python3\nimport asyncio\nimport traceback\n\nfrom cripy import connect\n\nasync def go() -\u003e None:\n    client = None\n    try:\n        client = await connect()\n        await asyncio.gather(client.Page.enable(), client.Network.enable())\n        await client.Page.navigate(\n            \"https://github.com/webrecorder/chrome-remote-interface-py\"\n        )\n        await client.Page.loadEventFired()\n    except Exception:\n        traceback.print_exc()\n    finally:\n        if client is not None:\n            await client.dispose()\n\n\nif __name__ == \"__main__\":\n    asyncio.get_event_loop().run_until_complete(go())\n```\n\nCDP Implementations\n---------------\n\nThis module should work with every application implementing the\n[Chrome Debugging Protocol]. \n\nBelow is a list of known implementations for reference\n\nImplementation             | Protocol version   | [Protocol] | [List] | [New] | [Activate] | [Close] | [Version]\n---------------------------|--------------------|------------|--------|-------|------------|---------|-----------\n[Google Chrome][1.1]       | [tip-of-tree][1.2] | yes¹       | yes    | yes   | yes        | yes     | yes\n[Opera][2.1]               | [tip-of-tree][2.2] | yes        | yes    | yes   | yes        | yes     | yes\n[Node.js][3.1] ([v6.3.0]+) | [node][3.2]        | yes        | no     | no    | no         | no      | yes\n[Safari (iOS)][4.1]        | [*partial*][4.2]   | no         | yes    | no    | no         | no      | no\n[Microsoft Edge][5.1]      | [*partial*][5.2]   | yes        | yes    | no    | no         | no      | yes\n\n¹ Not available on [Chrome for Android][chrome-mobile-protocol].\n\n[chrome-mobile-protocol]: https://bugs.chromium.org/p/chromium/issues/detail?id=824626#c4\n\n[1.1]: #chromechromium\n[1.2]: https://chromedevtools.github.io/devtools-protocol/tot/\n\n[2.1]: #opera\n[2.2]: https://chromedevtools.github.io/devtools-protocol/tot/\n\n[3.1]: #nodejs\n[3.2]: https://chromedevtools.github.io/devtools-protocol/v8/\n\n[4.1]: #safari-ios\n[4.2]: http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/inspector/protocol\n\n[5.1]: #edge\n[5.2]: https://docs.microsoft.com/en-us/microsoft-edge/devtools-protocol/0.1/domains/\n\n[Protocol]: #cdpprotocoloptions-callback\n[List]: #cdplistoptions-callback\n[New]: #cdpnewoptions-callback\n[Activate]: #cdpactivateoptions-callback\n[Close]: #cdpcloseoptions-callback\n[Version]: #cdpversionoptions-callback\n\nAPI\n---\n\nThe API consists of three parts:\n\n- *DevTools* methods (for those [implementations](#implementations) that support\n  them, e.g., [List](#cdplistoptions-callback), [New](#cdpnewoptions-callback),\n  etc.);\n\n- [connection](#cdpoptions-callback) establishment;\n\n- the actual [protocol interaction](#class-cdp).\n\n### connect([**kwargs])\n\nConnects to a remote instance using the [Chrome Debugging Protocol](https://chromedevtools.github.io/devtools-protocol/).\n\n`kwargs`:\n- `url: str`: URL or WS URL to use for making the CDP connection. Defaults to http://localhost:9222\n- `loop: AbstractEventLoop`: The event loop instance to use. Defaults to asyncio.get_event_loop\n- `remote: bool`: Boolean indicating if the protocol should be fetched from the remote instance or\n    to use the local one. Defaults to False (use local)\n    \nReturns:\n- `client: Client`: A CDP client connected to the remote browser instance\n\n\n\n### CDP.Protocol([**kwargs])\n\nFetch the [Chrome Debugging Protocol] descriptor.\n\n`kwargs`:\n- `frontend_url: str`: Base HTTP endpoint url to use (e.g. http(s)://localhost:9222)\n- `host: str`: HTTP frontend host. Defaults to `localhost` (ignored if frontend_url is supplied)\n- `port: Union[str, int]`: HTTP frontend port. Defaults to `9222` (ignored if frontend_url is supplied)\n- `secure: bool`: HTTPS/WSS frontend. Defaults to `false` \n\nReturns:\n- `protocol`: the [Chrome Debugging Protocol] descriptor.\n\nExample:\n\n```python3\nfrom cripy import Client\n\nasync def list_targets() -\u003e None:\n    protocol_descriptor = await Client.Protocol()\n    print(protocol_descriptor)\n```\n\n### Client.List([**kwargs])\n\nRequest the list of the available open targets/tabs of the remote instance.\n\n`kwargs`:\n- `frontend_url: str`: Base HTTP endpoint url to use (e.g. http(s)://localhost:9222)\n- `host: str`: HTTP frontend host. Defaults to `localhost` (ignored if frontend_url is supplied)\n- `port: Union[str, int]`: HTTP frontend port. Defaults to `9222` (ignored if frontend_url is supplied)\n- `secure: bool`: HTTPS/WSS frontend. Defaults to `false` \n\nReturns:\n- `Awaitable[List[Dict[str,str]]]`: the array returned by `http://host:port/json/list` containing the\n  target list.\n\nExample:\n\n```python3\nfrom cripy import Client\n\nasync def list_targets() -\u003e None:\n    for target in await Client.List():\n        print(target)\n```\n\n### CDP.New(url, [**kwargs])\n\nRequest the list of the available open targets/tabs of the remote instance.\n\n- `url: str`: The URL for the new tab. Defaults to about:blank\n\n`kwargs`:\n- `frontend_url: str`: Base HTTP endpoint url to use (e.g. http(s)://localhost:9222)\n- `host: str`: HTTP frontend host. Defaults to `localhost` (ignored if frontend_url is supplied)\n- `port: Union[str, int]`: HTTP frontend port. Defaults to `9222` (ignored if frontend_url is supplied)\n- `secure: bool`: HTTPS/WSS frontend. Defaults to `false` \n\nReturns:\n- `Awaitable[Dict[str,str]]`: the object returned by `http://host:port/json/new` containing the\n  target.\n\nExample:\n\n```python3\nfrom cripy import Client\n\nasync def list_targets() -\u003e None:\n    new_target = await Client.New(\"https://example.com\")\n    print(new_target)\n```\n\n### CDP.Activate(target_id, [**kwargs])\n\nActivate an open target/tab of the remote instance.\n- `target_id: str`: Target id. Required, no default.\n\n`kwargs`:\n- `frontend_url: str`: Base HTTP endpoint url to use (e.g. http(s)://localhost:9222)\n- `host: str`: HTTP frontend host. Defaults to `localhost` (ignored if frontend_url is supplied)\n- `port: Union[str, int]`: HTTP frontend port. Defaults to `9222` (ignored if frontend_url is supplied)\n- `secure: bool`: HTTPS/WSS frontend. Defaults to `false` \n\nReturns: \n- `Awaitable[Tuple[int, str]]`: results of activating the target\n\nExample:\n\n```python3\nfrom cripy import Client\n\nasync def list_targets() -\u003e None:\n    new_target = await Client.New(\"https://example.com\")\n    status_code, info = await Client.Activate(new_target[\"id\"])\n    print(f\"{status_code}, {info}\")\n```\n\n\n### CDP.Close(target_id, [**kwargs])\n\nClose an open target/tab of the remote instance.\n- `target_id: str`: Target id. Required, no default.\n\n`kwargs`:\n- `frontend_url: str`: Base HTTP endpoint url to use (e.g. http(s)://localhost:9222)\n- `host: str`: HTTP frontend host. Defaults to `localhost` (ignored if frontend_url is supplied)\n- `port: Union[str, int]`: HTTP frontend port. Defaults to `9222` (ignored if frontend_url is supplied)\n- `secure: bool`: HTTPS/WSS frontend. Defaults to `false` \n\nReturns: \n- `Awaitable[Tuple[int, str]]`: results of activating the target\n\nExample:\n\n```python3\nfrom cripy import Client\n\nasync def list_targets() -\u003e None:\n    new_target = await Client.New(\"https://example.com\")\n    status_code, info = await Client.close(new_target[\"id\"])\n    print(f\"{status_code}, {info}\")\n```\n\n### CDP.Version([**kwargs])\n\nRequest version information from the remote instance.\n\n`kwargs`:\n- `frontend_url: str`: Base HTTP endpoint url to use (e.g. http(s)://localhost:9222)\n- `host: str`: HTTP frontend host. Defaults to `localhost` (ignored if frontend_url is supplied)\n- `port: Union[str, int]`: HTTP frontend port. Defaults to `9222` (ignored if frontend_url is supplied)\n- `secure: bool`: HTTPS/WSS frontend. Defaults to `false` \n\nReturns:\n- `Dict[str, str]`: a JSON object returned by `http://host:port/json/version` containing\n  the version information.\n\n\nExample:\n\n```python3\nfrom cripy import Client\n\nasync def list_targets() -\u003e None:\n    version_info = await Client.Version()\n    print(version_info)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn0tan3rd%2Fchrome-remote-interface-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn0tan3rd%2Fchrome-remote-interface-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn0tan3rd%2Fchrome-remote-interface-py/lists"}