{"id":13805258,"url":"https://github.com/fate0/pychrome","last_synced_at":"2025-04-11T16:38:58.209Z","repository":{"id":47229239,"uuid":"98296979","full_name":"fate0/pychrome","owner":"fate0","description":"A Python Package for the Google Chrome Dev Protocol [threading base]","archived":false,"fork":false,"pushed_at":"2024-06-17T16:55:43.000Z","size":936,"stargazers_count":633,"open_issues_count":31,"forks_count":115,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-03T19:11:15.722Z","etag":null,"topics":["chrome","chrome-debugging-protocol","chrome-devtools","headless","headless-chrome","pychrome","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fate0.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-25T11:01:29.000Z","updated_at":"2025-04-02T15:27:55.000Z","dependencies_parsed_at":"2024-04-09T19:58:14.857Z","dependency_job_id":"3ff291dc-beee-4445-81b5-90ebb3e07941","html_url":"https://github.com/fate0/pychrome","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":"0.038461538461538436","last_synced_commit":"c6c755b9964eead9a84dd57e84f53eb9981b26ac"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fate0%2Fpychrome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fate0%2Fpychrome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fate0%2Fpychrome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fate0%2Fpychrome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fate0","download_url":"https://codeload.github.com/fate0/pychrome/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248441890,"owners_count":21104095,"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":["chrome","chrome-debugging-protocol","chrome-devtools","headless","headless-chrome","pychrome","python"],"created_at":"2024-08-04T01:00:59.217Z","updated_at":"2025-04-11T16:38:58.184Z","avatar_url":"https://github.com/fate0.png","language":"Python","readme":"# pychrome\n\n[![Build Status](https://travis-ci.org/fate0/pychrome.svg?branch=master)](https://travis-ci.org/fate0/pychrome)\n[![Codecov](https://img.shields.io/codecov/c/github/fate0/pychrome.svg)](https://codecov.io/gh/fate0/pychrome)\n[![Updates](https://pyup.io/repos/github/fate0/pychrome/shield.svg)](https://pyup.io/repos/github/fate0/pychrome/)\n[![PyPI](https://img.shields.io/pypi/v/pychrome.svg)](https://pypi.python.org/pypi/pychrome)\n[![PyPI](https://img.shields.io/pypi/pyversions/pychrome.svg)](https://github.com/fate0/pychrome)\n\nA Python Package for the Google Chrome Dev Protocol, [more document](https://fate0.github.io/pychrome/)\n\n## Table of Contents\n\n* [Installation](#installation)\n* [Setup Chrome](#setup-chrome)\n* [Getting Started](#getting-started)\n* [Tab management](#tab-management)\n* [Debug](#debug)\n* [Examples](#examples)\n* [Ref](#ref)\n\n\n## Installation\n\nTo install pychrome, simply:\n\n```\n$ pip install -U pychrome\n```\n\nor from GitHub:\n\n```\n$ pip install -U git+https://github.com/fate0/pychrome.git\n```\n\nor from source:\n\n```\n$ python setup.py install\n```\n\n## Setup Chrome\n\nsimply:\n\n```\n$ google-chrome --remote-debugging-port=9222\n```\n\nor headless mode (chrome version \u003e= 59):\n\n```\n$ google-chrome --headless --disable-gpu --remote-debugging-port=9222\n```\n\nor use docker:\n\n```\n$ docker pull fate0/headless-chrome\n$ docker run -it --rm --cap-add=SYS_ADMIN -p9222:9222 fate0/headless-chrome\n```\n\n## Getting Started\n\n``` python\nimport pychrome\n\n# create a browser instance\nbrowser = pychrome.Browser(url=\"http://127.0.0.1:9222\")\n\n# create a tab\ntab = browser.new_tab()\n\n# register callback if you want\ndef request_will_be_sent(**kwargs):\n    print(\"loading: %s\" % kwargs.get('request').get('url'))\n\ntab.Network.requestWillBeSent = request_will_be_sent\n\n# start the tab \ntab.start()\n\n# call method\ntab.Network.enable()\n# call method with timeout\ntab.Page.navigate(url=\"https://github.com/fate0/pychrome\", _timeout=5)\n\n# wait for loading\ntab.wait(5)\n\n# stop the tab (stop handle events and stop recv message from chrome)\ntab.stop()\n\n# close tab\nbrowser.close_tab(tab)\n\n```\n\nor (alternate syntax)\n\n``` python\nimport pychrome\n\nbrowser = pychrome.Browser(url=\"http://127.0.0.1:9222\")\ntab = browser.new_tab()\n\ndef request_will_be_sent(**kwargs):\n    print(\"loading: %s\" % kwargs.get('request').get('url'))\n\n\ntab.set_listener(\"Network.requestWillBeSent\", request_will_be_sent)\n\ntab.start()\ntab.call_method(\"Network.enable\")\ntab.call_method(\"Page.navigate\", url=\"https://github.com/fate0/pychrome\", _timeout=5)\n\ntab.wait(5)\ntab.stop()\n\nbrowser.close_tab(tab)\n```\n\nmore methods or events could be found in\n[Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/tot/)\n\n\n## Debug\n\nset DEBUG env variable:\n\n![pychrome_with_debug_env](https://raw.githubusercontent.com/fate0/pychrome/master/docs/images/pychrome_with_debug_env.png)\n\n\n## Tab management\n\nrun `pychrome -h` for more info\n\nexample:\n\n![pychrome_tab_management](https://raw.githubusercontent.com/fate0/pychrome/master/docs/images/pychrome_tab_management.png)\n\n\n## Examples\n\nplease see the [examples](http://github.com/fate0/pychrome/blob/master/examples) directory for more examples\n\n\n## Ref\n\n* [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface/)\n* [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/tot/)\n","funding_links":[],"categories":["Python","Alumni"],"sub_categories":["Automation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffate0%2Fpychrome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffate0%2Fpychrome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffate0%2Fpychrome/lists"}