ichrome


Nameichrome JSON
Version 4.0.2 PyPI version JSON
download
home_pagehttps://github.com/ClericPy/ichrome
SummaryChrome controller for Humans, base on Chrome Devtools Protocol(CDP) and python3.7+. Read more: https://github.com/ClericPy/ichrome.
upload_time2024-06-04 11:14:26
maintainerNone
docs_urlNone
authorClericPy
requires_pythonNone
licenseMIT License
keywords chrome chrome devtools protocol daemon cdp browser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [ichrome](https://github.com/ClericPy/ichrome) [![PyPI](https://img.shields.io/pypi/v/ichrome?style=plastic)](https://pypi.org/project/ichrome/)![PyPI - Wheel](https://img.shields.io/pypi/wheel/ichrome?style=plastic)![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ichrome?style=plastic)![PyPI - Downloads](https://img.shields.io/pypi/dm/ichrome?style=plastic)![PyPI - License](https://img.shields.io/pypi/l/ichrome?style=plastic)

----------

> Chrome controller for Humans, base on [Chrome Devtools Protocol(CDP)](https://chromedevtools.github.io/devtools-protocol/) and python3.7+. [Read Docs](https://clericpy.github.io/ichrome/)

![image](https://github.com/ClericPy/ichrome/raw/master/structure.png)

> If you encounter any problems, please let me know through [issues](https://github.com/ClericPy/ichrome/issues), some of them will be a good opinion for the enhancement of `ichrome`.


# Install

    pip install ichrome -U

> Uninstall & Clear the user data folder

        $ python3 -m ichrome --clean
        $ pip uninstall ichrome

## Quick Start

```python
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.goto('https://github.com/ClericPy/ichrome', timeout=5)
            print(await tab.title)
        # Privacy Mode, proxyServer arg maybe not work on Chrome, for `Target.createBrowserContext` is the EXPERIMENTAL feature(but chromium is ok).
        # https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createBrowserContext
        async with cd.incognito_tab(proxyServer='http://127.0.0.1:8080') as tab:
            await tab.goto('https://httpbin.org/ip', timeout=5)
            print(await tab.html)


asyncio.run(test())
```

### [Read Docs](https://clericpy.github.io/ichrome/)

# Why?

- In desperate need of a stable toolkit to communicate with Chrome browser (or other Blink-based browsers such as Chromium)
  - `ichrome` includes fast http & websocket connections (based on aiohttp) within an **asyncio** environment
- Pyppeteer is awesome
  - But I don't need so much, and the spelling of pyppeteer is confused
  - Event-driven architecture(EDA) is not always smart.
- Selenium is slow
  - Webdriver often comes with memory leak
    - PhantomJS development is suspended
  - No native coroutine(`asyncio`) support
- Playwright comes too late
  - This may be a good choice for both `sync` and `async` usage
    - The 1st author of `puppeteer` joined it.
  - But its core code is based on Node.js, which is too hard to monkey-patch.

# Features

> As we known, **`Javascript` is the first-class citizen of the Browser world**, so learn to use it with `ichrome` frequently.

- A process daemon of Chrome instances
  - **auto-restart**
  - command-line usage
  - `async` environment compatible
- Connect to an **existing** Chrome
- Operations on Tabs under stable `websocket`
  - Commonly used functions
  - `Incognito Mode`
- `ChromeEngine` as the progress pool
  - support HTTP `api` router with [FastAPI](https://github.com/tiangolo/fastapi) (EXPERIMENTAL)
    - launch the chrome pool with `python -m ichrome.web`
      - `python -m ichrome.web --help` for usage
- `Flatten` mode with `sessionId`
  - Create only **1** WebSocket connection
  - New in version 2.9.0
    - [EXPERIMENTAL](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget)
    - Share the same `Websocket` connection and use `sessionId` to distinguish requests
  - After v3.0.1
    - `AsyncTab._DEFAULT_FLATTEN = True`
- The install script of chromium
- debug mode for sync usage with `ichrome.debugger` >4.0.0 (EXPERIMENTAL)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ClericPy/ichrome",
    "name": "ichrome",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "chrome, Chrome Devtools Protocol, daemon, CDP, browser",
    "author": "ClericPy",
    "author_email": "clericpy@gmail.com",
    "download_url": null,
    "platform": "any",
    "description": "[ichrome](https://github.com/ClericPy/ichrome) [![PyPI](https://img.shields.io/pypi/v/ichrome?style=plastic)](https://pypi.org/project/ichrome/)![PyPI - Wheel](https://img.shields.io/pypi/wheel/ichrome?style=plastic)![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ichrome?style=plastic)![PyPI - Downloads](https://img.shields.io/pypi/dm/ichrome?style=plastic)![PyPI - License](https://img.shields.io/pypi/l/ichrome?style=plastic)\r\n\r\n----------\r\n\r\n> Chrome controller for Humans, base on [Chrome Devtools Protocol(CDP)](https://chromedevtools.github.io/devtools-protocol/) and python3.7+. [Read Docs](https://clericpy.github.io/ichrome/)\r\n\r\n![image](https://github.com/ClericPy/ichrome/raw/master/structure.png)\r\n\r\n> If you encounter any problems, please let me know through [issues](https://github.com/ClericPy/ichrome/issues), some of them will be a good opinion for the enhancement of `ichrome`.\r\n\r\n\r\n# Install\r\n\r\n    pip install ichrome -U\r\n\r\n> Uninstall & Clear the user data folder\r\n\r\n        $ python3 -m ichrome --clean\r\n        $ pip uninstall ichrome\r\n\r\n## Quick Start\r\n\r\n```python\r\nimport asyncio\r\nfrom ichrome import AsyncChromeDaemon\r\n\r\n\r\nasync def test():\r\n    async with AsyncChromeDaemon() as cd:\r\n        # create a new tab\r\n        async with cd.connect_tab(index=None) as tab:\r\n            await tab.goto('https://github.com/ClericPy/ichrome', timeout=5)\r\n            print(await tab.title)\r\n        # Privacy Mode, proxyServer arg maybe not work on Chrome, for `Target.createBrowserContext` is the EXPERIMENTAL feature(but chromium is ok).\r\n        # https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createBrowserContext\r\n        async with cd.incognito_tab(proxyServer='http://127.0.0.1:8080') as tab:\r\n            await tab.goto('https://httpbin.org/ip', timeout=5)\r\n            print(await tab.html)\r\n\r\n\r\nasyncio.run(test())\r\n```\r\n\r\n### [Read Docs](https://clericpy.github.io/ichrome/)\r\n\r\n# Why?\r\n\r\n- In desperate need of a stable toolkit to communicate with Chrome browser (or other Blink-based browsers such as Chromium)\r\n  - `ichrome` includes fast http & websocket connections (based on aiohttp) within an **asyncio** environment\r\n- Pyppeteer is awesome\r\n  - But I don't need so much, and the spelling of pyppeteer is confused\r\n  - Event-driven architecture(EDA) is not always smart.\r\n- Selenium is slow\r\n  - Webdriver often comes with memory leak\r\n    - PhantomJS development is suspended\r\n  - No native coroutine(`asyncio`) support\r\n- Playwright comes too late\r\n  - This may be a good choice for both `sync` and `async` usage\r\n    - The 1st author of `puppeteer` joined it.\r\n  - But its core code is based on Node.js, which is too hard to monkey-patch.\r\n\r\n# Features\r\n\r\n> As we known, **`Javascript` is the first-class citizen of the Browser world**, so learn to use it with `ichrome` frequently.\r\n\r\n- A process daemon of Chrome instances\r\n  - **auto-restart**\r\n  - command-line usage\r\n  - `async` environment compatible\r\n- Connect to an **existing** Chrome\r\n- Operations on Tabs under stable `websocket`\r\n  - Commonly used functions\r\n  - `Incognito Mode`\r\n- `ChromeEngine` as the progress pool\r\n  - support HTTP `api` router with [FastAPI](https://github.com/tiangolo/fastapi) (EXPERIMENTAL)\r\n    - launch the chrome pool with `python -m ichrome.web`\r\n      - `python -m ichrome.web --help` for usage\r\n- `Flatten` mode with `sessionId`\r\n  - Create only **1** WebSocket connection\r\n  - New in version 2.9.0\r\n    - [EXPERIMENTAL](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget)\r\n    - Share the same `Websocket` connection and use `sessionId` to distinguish requests\r\n  - After v3.0.1\r\n    - `AsyncTab._DEFAULT_FLATTEN = True`\r\n- The install script of chromium\r\n- debug mode for sync usage with `ichrome.debugger` >4.0.0 (EXPERIMENTAL)\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Chrome controller for Humans, base on Chrome Devtools Protocol(CDP) and python3.7+. Read more: https://github.com/ClericPy/ichrome.",
    "version": "4.0.2",
    "project_urls": {
        "Homepage": "https://github.com/ClericPy/ichrome"
    },
    "split_keywords": [
        "chrome",
        " chrome devtools protocol",
        " daemon",
        " cdp",
        " browser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f58d9f0543cca52e115d7dad145a37be1f4c0cd5fa8bc9636fb195c959c9a31d",
                "md5": "e21180fa55238aa990eb055ad66656a3",
                "sha256": "5767f24ce4dbfa7f48c65672c048b37dbfa39a262f1c0dd103bfc515ddf53749"
            },
            "downloads": -1,
            "filename": "ichrome-4.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e21180fa55238aa990eb055ad66656a3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 69897,
            "upload_time": "2024-06-04T11:14:26",
            "upload_time_iso_8601": "2024-06-04T11:14:26.327069Z",
            "url": "https://files.pythonhosted.org/packages/f5/8d/9f0543cca52e115d7dad145a37be1f4c0cd5fa8bc9636fb195c959c9a31d/ichrome-4.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-04 11:14:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ClericPy",
    "github_project": "ichrome",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "ichrome"
}
        
Elapsed time: 4.50028s