{"id":26336930,"url":"https://github.com/d-chris/chromesession","last_synced_at":"2026-02-28T20:04:28.313Z","repository":{"id":282461222,"uuid":"948057576","full_name":"d-chris/chromesession","owner":"d-chris","description":"contextmanager for managing `selenium` chrome sessions with caching.","archived":false,"fork":false,"pushed_at":"2025-12-19T05:04:13.000Z","size":285,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-05T06:23:19.103Z","etag":null,"topics":["beautifulsoup4","chromedriver-py","python","requests-cache","responses","selenium"],"latest_commit_sha":null,"homepage":"https://d-chris.github.io/chromesession/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d-chris.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-13T17:16:38.000Z","updated_at":"2025-09-09T08:44:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d6d8061-7525-4ca4-88bf-2ba5a7de7d88","html_url":"https://github.com/d-chris/chromesession","commit_stats":null,"previous_names":["d-chris/chromesession"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/d-chris/chromesession","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-chris%2Fchromesession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-chris%2Fchromesession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-chris%2Fchromesession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-chris%2Fchromesession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d-chris","download_url":"https://codeload.github.com/d-chris/chromesession/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-chris%2Fchromesession/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29951101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["beautifulsoup4","chromedriver-py","python","requests-cache","responses","selenium"],"created_at":"2025-03-16T02:16:47.667Z","updated_at":"2026-02-28T20:04:28.299Z","avatar_url":"https://github.com/d-chris.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chromesession\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chromesession)](https://pypi.org/project/chromesession/)\n[![PyPI - Version](https://img.shields.io/pypi/v/chromesession)](https://pypi.org/project/chromesession/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/chromesession)](https://pypi.org/project/chromesession/)\n[![PyPI - License](https://img.shields.io/pypi/l/chromesession)](https://raw.githubusercontent.com/d-chris/chromesession/main/LICENSE)\n[![GitHub - Pytest](https://img.shields.io/github/actions/workflow/status/d-chris/chromesession/pytest.yml?logo=github\u0026label=pytest)](https://github.com/d-chris/chromesession/actions/workflows/pytest.yml)\n[![GitHub - Page](https://img.shields.io/website?url=https%3A%2F%2Fd-chris.github.io%2Fchromesession\u0026up_message=pdoc\u0026logo=github\u0026label=documentation)](https://d-chris.github.io/chromesession)\n[![GitHub - Release](https://img.shields.io/github/v/tag/d-chris/chromesession?logo=github\u0026label=github)](https://github.com/d-chris/chromesession)\n[![codecov](https://codecov.io/gh/d-chris/chromesession/graph/badge.svg?token=OFD1IARN1U)](https://codecov.io/gh/d-chris/chromesession)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://raw.githubusercontent.com/d-chris/chromesession/main/.pre-commit-config.yaml)\n\n---\n\n`chromesession` is a Python package that provides a convenient contextmanager for managing `selenium` chrome sessions.\n\nIn addition, a `CachedSession` is provided to directly cache the driver responses.\n\n## Installation\n\n```cmd\npip install chromesession\n```\n\nTo use the `chromesession.chrome` context manager with `selenium`, the [chromedriver](https://googlechromelabs.github.io/chrome-for-testing/) must be installed on the system.\n\nAlternatively, you can install the latest `chromedriver` as an [extra](#extras).\n\n```cmd\npip install chromesession[driver]\n```\n\n## Examples\n\nCache the specified URLs by fetching them via Selenium and saving the responses.\n\n```python\nfrom pathlib import Path\n\nfrom chromesession import CachedSession, chrome\n\n\ndef caching(*urls: str) -\u003e Path:\n    \"\"\"\n    Cache the specified URLs by fetching them via Selenium and saving the responses.\n    \"\"\"\n    cachfile = \"caching.sqlite\"\n\n    with CachedSession(cache_name=cachfile) as session:\n        with chrome(verbose=False) as driver:\n            for url in urls:\n                if url in session:\n                    print(f\"{url=} already cached.\")\n                    continue\n\n                try:\n                    driver.get(url)\n                    session.save_driver(driver)\n                except Exception as e:\n                    print(f\"{url=} failed to cache: {e}\", exc_info=True)\n                else:\n                    print(f\"{url=} saved in cache.\")\n\n    return Path(cachfile)\n\n\nif __name__ == \"__main__\":\n\n    caching(\"https://example.com/\", \"https://example.com/\")\n```\n\n## Dependencies\n\n[![PyPI - requests-cache](https://img.shields.io/pypi/v/requests-cache?logo=pypi\u0026logoColor=white\u0026label=requests-cache)](https://pypi.org/project/requests-cache/)\n[![PyPI - responses](https://img.shields.io/pypi/v/responses?logo=pypi\u0026logoColor=white\u0026label=responses)](https://pypi.org/project/responses/)\n[![PyPI - selenium](https://img.shields.io/pypi/v/selenium?logo=pypi\u0026logoColor=white\u0026label=selenium)](https://pypi.org/project/selenium/)\n\n## Extras\n\nInstall optional dependencies using extras.\n\n| extra  | installation                        | dependency                                                                                                                                                           |\n| ------ | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| all    | `pip install chromesession[all]`    | Install all extras.                                                                                                                                                  |\n| driver | `pip install chromesession[driver]` | [![PyPI - chromedrive-py](https://img.shields.io/pypi/v/chromedriver-py?logo=pypi\u0026logoColor=white\u0026label=chromedriver-py)](https://pypi.org/project/chromedriver-py/) |\n| bs4    | `pip install chromesession[bs4]`    | [![PyPI - beautifulsoup4](https://img.shields.io/pypi/v/beautifulsoup4?logo=pypi\u0026logoColor=white\u0026label=beautifulsoup4)](https://pypi.org/project/beautifulsoup4/)    |\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-chris%2Fchromesession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd-chris%2Fchromesession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-chris%2Fchromesession/lists"}